@devilsdev/rag-pipeline-utils 2.1.4 → 2.1.7

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.
Files changed (34) hide show
  1. package/.github/PROJECT_ROADMAP.md +102 -0
  2. package/.github/PULL_REQUEST_TEMPLATE.md +8 -0
  3. package/.github/workflows/auto-release-note.yml +73 -0
  4. package/.github/workflows/ci.yml +5 -3
  5. package/.github/workflows/docs-ci.yml +12 -15
  6. package/.github/workflows/docs-deploy.yml +24 -10
  7. package/.github/workflows/enforce-release-review.yml +50 -0
  8. package/.github/workflows/generate-blog-post.yml +44 -0
  9. package/.github/workflows/post-release-generate-blog.yml +71 -0
  10. package/.github/workflows/release-sync.yml +50 -0
  11. package/.github/workflows/roadmap-label-sync.yml +35 -0
  12. package/.github/workflows/roadmap-labels.yml +67 -0
  13. package/.github/workflows/roadmap-sync.yml +44 -0
  14. package/.github/workflows/sync-roadmap.yml +62 -0
  15. package/.github/workflows/verify-blog-badge.yml +50 -0
  16. package/CHANGELOG.md +41 -0
  17. package/README.md +40 -0
  18. package/__tests__/scripts/ensure-roadmap-labels.test.js +64 -0
  19. package/docs-site/blog/2025-04-21-release-v2.1.4.md +13 -0
  20. package/docs-site/blog/2025-04-22-release-v2.1.5.md +13 -0
  21. package/docs-site/blog/2025-04-24-v2.1.6.md +21 -0
  22. package/docs-site/package.json +4 -1
  23. package/package.json +7 -11
  24. package/scripts/banner-injector.js +82 -69
  25. package/scripts/close-done-roadmap-issues.js +65 -0
  26. package/scripts/create-roadmap-issues.js +47 -0
  27. package/scripts/ensure-roadmap-labels.js +73 -0
  28. package/scripts/generate-release-note.js +97 -27
  29. package/scripts/get-previous-tag.js +40 -0
  30. package/scripts/label-roadmap-issues.js +125 -0
  31. package/scripts/manual-test-checklist.md +90 -0
  32. package/scripts/sync-labels.js +71 -0
  33. package/scripts/sync-roadmap-labels.js +21 -0
  34. package/scripts/tag-release.js +64 -0
@@ -0,0 +1,44 @@
1
+ name: 🚀 Roadmap Sync (Labels + Issues)
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ paths:
7
+ - '.github/roadmap-labels.yml'
8
+ - '.github/PROJECT_ROADMAP.md'
9
+ - 'scripts/create-roadmap-issues.js'
10
+ - 'scripts/ensure-roadmap-labels.js'
11
+
12
+ workflow_dispatch:
13
+
14
+ permissions:
15
+ issues: write
16
+ contents: read
17
+
18
+ jobs:
19
+ roadmap-sync:
20
+ name: 🔁 Sync Labels + Issues from Roadmap
21
+ runs-on: ubuntu-latest
22
+
23
+ steps:
24
+ - name: 📥 Checkout repository
25
+ uses: actions/checkout@v4
26
+
27
+ - name: 🛠 Setup Node.js
28
+ uses: actions/setup-node@v4
29
+ with:
30
+ node-version: 20
31
+ cache: 'npm'
32
+
33
+ - name: 📦 Install dependencies
34
+ run: npm ci
35
+
36
+ - name: 🔖 Sync GitHub labels from roadmap-labels.yml
37
+ run: node scripts/ensure-roadmap-labels.js
38
+ env:
39
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40
+
41
+ - name: 📝 Create or update roadmap issues
42
+ run: node scripts/create-roadmap-issues.js
43
+ env:
44
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -0,0 +1,62 @@
1
+ # .github/workflows/sync-roadmap.yml
2
+ # Version: 2.1.0
3
+ # Description: Unified workflow to sync roadmap issues, labels, and states
4
+ # Author: Ali Kahwaji
5
+
6
+ name: 🚀 Sync Roadmap to GitHub Issues
7
+
8
+ on:
9
+ workflow_dispatch:
10
+ push:
11
+ branches: [main]
12
+ paths:
13
+ - '.github/PROJECT_ROADMAP.md'
14
+ - '.github/workflows/sync-roadmap.yml'
15
+ - 'scripts/**.js'
16
+
17
+ permissions:
18
+ contents: write
19
+ issues: write
20
+
21
+ jobs:
22
+ sync:
23
+ name: 📌 Roadmap Sync
24
+ runs-on: ubuntu-latest
25
+
26
+ steps:
27
+ - name: ⬇️ Checkout
28
+ uses: actions/checkout@v4
29
+
30
+ - name: 🛠 Setup Node.js
31
+ uses: actions/setup-node@v4
32
+ with:
33
+ node-version: 20
34
+
35
+ - name: 📦 Install roadmap dependencies
36
+ run: npm install
37
+ env:
38
+ NODE_ENV: development
39
+
40
+ - name: 🔖 Ensure roadmap labels exist
41
+ run: node scripts/ensure-roadmap-labels.js
42
+ env:
43
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
44
+ GITHUB_REPO: ${{ github.repository }}
45
+
46
+ - name: 🗂 Sync roadmap issues
47
+ run: node scripts/create-roadmap-issues.js
48
+ env:
49
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
50
+ GITHUB_REPO: ${{ github.repository }}
51
+
52
+ - name: 🏷 Apply labels to roadmap issues
53
+ run: node scripts/label-roadmap-issues.js
54
+ env:
55
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
56
+ GITHUB_REPO: ${{ github.repository }}
57
+
58
+ - name: ✅ Close completed issues
59
+ run: node scripts/close-done-roadmap-issues.js
60
+ env:
61
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
62
+ GITHUB_REPO: ${{ github.repository }}
@@ -0,0 +1,50 @@
1
+ # .github/workflows/verify-blog-badge.yml
2
+ # Version: 1.3.0
3
+ # Description: Validates presence of blog generation badge + GitHub Action output
4
+ # Author: Ali Kahwaji
5
+
6
+ name: 🖍 Blog Badge Verification
7
+
8
+ on:
9
+ workflow_dispatch:
10
+ workflow_run:
11
+ workflows: ["Auto Generate Blog + Changelog"]
12
+ types:
13
+ - completed
14
+
15
+ jobs:
16
+ verify:
17
+ name: 🌟 Verify Blog Badge and Output
18
+ runs-on: ubuntu-latest
19
+ if: ${{ github.event.workflow_run.conclusion == 'success' }}
20
+
21
+ steps:
22
+ - name: ⬇️ Checkout repository
23
+ uses: actions/checkout@v4
24
+
25
+ - name: 🔍 Validate README badge reference
26
+ run: |
27
+ echo "Checking for badge reference in README.md..."
28
+ grep -q "post-release-generate-blog.yml/badge.svg" README.md || {
29
+ echo "❌ Missing badge for post-release-generate-blog.yml in README.md"
30
+ exit 1
31
+ }
32
+
33
+ - name: 🌐 Validate badge URL status
34
+ run: |
35
+ BADGE_URL="https://github.com/DevilsDev/rag-pipeline-utils/actions/workflows/post-release-generate-blog.yml/badge.svg?branch=main"
36
+ STATUS=$(curl -s -o /dev/null -w "%{http_code}" "$BADGE_URL")
37
+
38
+ echo "Badge response: $STATUS"
39
+ if [ "$STATUS" != "200" ]; then
40
+ echo "❌ Blog badge not reachable (HTTP $STATUS)"
41
+ exit 1
42
+ fi
43
+
44
+ - name: 🧾 Log assumed blog generation output (manual mapping)
45
+ run: |
46
+ echo "⚠️ Outputs from 'workflow_run' do not include job outputs."
47
+ echo "Assuming blog_generated=true based on successful workflow completion."
48
+
49
+ - name: ✅ Blog badge verified
50
+ run: echo "✅ Blog badge verified and present in README."
package/CHANGELOG.md CHANGED
@@ -1,5 +1,36 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.1.7](https://github.com/DevilsDev/rag-pipeline-utils/compare/v2.1.6...v2.1.7) (2025-04-25)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * **ci:** patch blog release workflow with DRY_RUN and safer outputs ([18f1b7d](https://github.com/DevilsDev/rag-pipeline-utils/commit/18f1b7dd4019022d76de9097db1ff8cfd858d83e))
9
+
10
+ <<<<<<< HEAD
11
+ ## 2.1.5 - 2025-04-22
12
+ ### Features
13
+ - Synced roadmap labels + issues via CI
14
+ - Added auto-close for Done roadmap entries
15
+
16
+ ### Fixes
17
+ - ES module compatibility fixes for roadmap scripts
18
+ - Improved test isolation and mocking for Octokit
19
+
20
+ ### DevOps
21
+ - CI chain includes roadmap validation and label sync
22
+ - CLI tools support changelog generation + blog linking
23
+
24
+
25
+ =======
26
+ ## [2.1.5](https://github.com/DevilsDev/rag-pipeline-utils/compare/v2.1.4...v2.1.5) (2025-04-22)
27
+
28
+
29
+ ### Bug Fixes
30
+
31
+ * **scripts:** prevent null status crash in roadmap issue closer ([89d5a0b](https://github.com/DevilsDev/rag-pipeline-utils/commit/89d5a0bc4cac554975974558b97974297816f169))
32
+
33
+ >>>>>>> 6475a97d362f7cd9779e1268f1c816764a7fd62c
3
34
  ## [2.1.4](https://github.com/DevilsDev/rag-pipeline-utils/compare/v2.1.3...v2.1.4) (2025-04-21)
4
35
 
5
36
 
@@ -88,3 +119,13 @@
88
119
  All notable changes to this project will be documented in this file.
89
120
 
90
121
  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.
122
+
123
+ ## v2.1.6
124
+
125
+ - chore: remove legacy changelog workflow and finalize blog badge
126
+ - ci(workflows): add blog badge verification workflow
127
+ - ci(workflows): add blog badge verification workflow
128
+ - ci(workflows): add blog badge verification workflow
129
+ - docs(blog): add release post for v2.1.5
130
+
131
+ ---
package/README.md CHANGED
@@ -10,6 +10,16 @@
10
10
  [![codecov](https://codecov.io/gh/DevilsDev/rag-pipeline-utils/branch/main/graph/badge.svg)](https://codecov.io/gh/DevilsDev/rag-pipeline-utils)
11
11
  ![Release](https://img.shields.io/github/v/release/DevilsDev/rag-pipeline-utils?label=release)
12
12
  ![License](https://img.shields.io/github/license/devilsdev/rag-pipeline-utils)
13
+ ![Release Review Passed](https://github.com/DevilsDev/rag-pipeline-utils/actions/workflows/enforce-release-review.yml/badge.svg?branch=main)
14
+ [![Docs Deploy](https://github.com/DevilsDev/rag-pipeline-utils/actions/workflows/docs-deploy.yml/badge.svg)](https://github.com/DevilsDev/rag-pipeline-utils/actions/workflows/docs-deploy.yml)
15
+ [![Docs CI](https://github.com/DevilsDev/rag-pipeline-utils/actions/workflows/docs-ci.yml/badge.svg)](https://github.com/DevilsDev/rag-pipeline-utils/actions/workflows/docs-ci.yml)
16
+ [![Blog Generated](https://github.com/DevilsDev/rag-pipeline-utils/actions/workflows/post-release-generate-blog.yml/badge.svg?branch=main)](https://github.com/DevilsDev/rag-pipeline-utils/actions/workflows/post-release-generate-blog.yml)
17
+
18
+
19
+
20
+
21
+
22
+
13
23
 
14
24
  ## Description
15
25
 
@@ -136,6 +146,36 @@ We welcome contributions via PRs, especially new mock providers, validation help
136
146
 
137
147
 
138
148
 
149
+ ## Contributors Guide
150
+
151
+ For active maintainers and collaborators:
152
+
153
+ - **Roadmap & Feature Planning**
154
+ See [.github/PROJECT_ROADMAP.md](.github/PROJECT_ROADMAP.md) for the implementation phases, priorities, and tracking tags for all major developer-facing features.
155
+
156
+ - **Milestone Tags**
157
+ | Tag | Description |
158
+ |-------------|------------------------------------|
159
+ | `phase-1` | Foundation – testing, CI, tutorials |
160
+ | `phase-2` | Community, blog, discussions |
161
+ | `phase-3` | CLI, VS Code tools, theming |
162
+ | `phase-4` | i18n, integrations, case studies |
163
+
164
+ _Note: This file is not included in public documentation builds._
165
+
166
+
167
+ ## Manual Test Checklist
168
+
169
+ For full validation of roadmap sync, changelog automation, CI/CD, and blog generation:
170
+
171
+ ➡️ [View Manual Test Checklist](scripts/manual-test-checklist.md)
172
+
173
+ ## Manual CI Rollout
174
+
175
+ git commit --allow-empty -m "ci(test): trigger all CI workflows"
176
+ git push origin main
177
+
178
+
139
179
  ## License
140
180
 
141
181
  This project is licensed under the **GNU GPL v3.0** License - see the [LICENSE](./LICENSE) file for details.
@@ -0,0 +1,64 @@
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
+ });
@@ -0,0 +1,13 @@
1
+ ---
2
+ slug: release-v2.1.4
3
+ title: ✨ Version v2.1.4 Released
4
+ authors: [ali]
5
+ tags: [release, changelog]
6
+ ---
7
+
8
+ RAG Pipeline Utils vv2.1.4 is now available on NPM!
9
+
10
+ #### Highlights
11
+ - 🚀 Auto-published blog from GitHub Release
12
+ - 📦 Version bump: v2.1.4
13
+ - 📘 See CHANGELOG.md for full details
@@ -0,0 +1,13 @@
1
+ ---
2
+ slug: release-v2.1.5
3
+ title: ✨ Version v2.1.5 Released
4
+ authors: [ali]
5
+ tags: [release, changelog]
6
+ ---
7
+
8
+ RAG Pipeline Utils vv2.1.5 is now available on NPM!
9
+
10
+ #### Highlights
11
+ - 🚀 Auto-published blog from GitHub Release
12
+ - 📦 Version bump: v2.1.5
13
+ - 📘 See CHANGELOG.md for full details
@@ -0,0 +1,21 @@
1
+ ---
2
+ slug: release-v2.1.6
3
+ title: "🚀 Version v2.1.6 Released"
4
+ authors: [ali]
5
+ tags: [release, changelog]
6
+ ---
7
+
8
+ RAG Pipeline Utils **v2.1.6** is now available on NPM!
9
+
10
+ ## 🔧 Changes
11
+
12
+ - chore: remove legacy changelog workflow and finalize blog badge
13
+ - ci(workflows): add blog badge verification workflow
14
+ - ci(workflows): add blog badge verification workflow
15
+ - ci(workflows): add blog badge verification workflow
16
+ - docs(blog): add release post for v2.1.5
17
+
18
+ ## 🔗 Resources
19
+
20
+ - GitHub Compare: [v2.1.5...v2.1.6](https://github.com/DevilsDev/rag-pipeline-utils/compare/v2.1.5...v2.1.6)
21
+ - View full [CHANGELOG.md](../../CHANGELOG.md)
@@ -11,7 +11,10 @@
11
11
  "clear": "docusaurus clear",
12
12
  "serve": "docusaurus serve",
13
13
  "write-translations": "docusaurus write-translations",
14
- "write-heading-ids": "docusaurus write-heading-ids"
14
+ "write-heading-ids": "docusaurus write-heading-ids",
15
+ "lint": "echo 'Lint skipped for docs-site'",
16
+ "test": "echo 'No tests in docs-site. Run from root.'",
17
+ "docs:build": "npm run --workspace ../ docs:build"
15
18
  },
16
19
  "dependencies": {
17
20
  "@docusaurus/core": "3.7.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devilsdev/rag-pipeline-utils",
3
- "version": "2.1.4",
3
+ "version": "2.1.7",
4
4
  "description": "A modular toolkit for building RAG (Retrieval-Augmented Generation) pipelines in Node.js",
5
5
  "main": "src/core/create-pipeline.js",
6
6
  "bin": {
@@ -27,7 +27,10 @@
27
27
  "docs:start": "docusaurus start docs-site",
28
28
  "docs:build": "docusaurus build docs-site",
29
29
  "docs:serve": "docusaurus serve docs-site",
30
- "docs:deploy": "docusaurus deploy docs-site"
30
+ "docs:deploy": "docusaurus deploy docs-site",
31
+ "roadmap:close": "node scripts/close-done-roadmap-issues.js",
32
+ "labels:sync": "node scripts/ensure-roadmap-labels.js",
33
+ "release:tag": "node scripts/generate-release-note.js v$(node -p \"require('./package.json').version\")"
31
34
  },
32
35
  "lint-staged": {
33
36
  "**/*.{js,ts}": [
@@ -68,14 +71,6 @@
68
71
  "@semantic-release/github": "^9.2.6",
69
72
  "@semantic-release/npm": "^11.0.3",
70
73
  "@semantic-release/release-notes-generator": "^14.0.3",
71
- "@storybook/addon-essentials": "^8.6.12",
72
- "@storybook/addon-interactions": "^8.6.12",
73
- "@storybook/addon-onboarding": "^8.6.12",
74
- "@storybook/addon-webpack5-compiler-swc": "^3.0.0",
75
- "@storybook/blocks": "^8.6.12",
76
- "@storybook/react": "^8.6.12",
77
- "@storybook/react-webpack5": "^8.6.12",
78
- "@storybook/test": "^8.6.12",
79
74
  "@types/jest": "^29.5.14",
80
75
  "babel-jest": "^29.7.0",
81
76
  "codecov": "^3.8.2",
@@ -92,10 +87,10 @@
92
87
  "prop-types": "^15.8.1",
93
88
  "rimraf": "^6.0.1",
94
89
  "semantic-release": "^21.1.2",
95
- "storybook": "^8.6.12",
96
90
  "ts-jest": "^29.3.2"
97
91
  },
98
92
  "dependencies": {
93
+ "@octokit/rest": "^21.1.1",
99
94
  "ajv": "^8.17.1",
100
95
  "axios": "^1.8.4",
101
96
  "chalk": "^5.4.1",
@@ -105,6 +100,7 @@
105
100
  "fast-glob": "^3.3.3",
106
101
  "framer-motion": "^12.7.4",
107
102
  "jsdom": "^26.1.0",
103
+ "octokit": "^4.1.3",
108
104
  "openai": "^4.93.0",
109
105
  "pino": "^9.6.0",
110
106
  "plaiceholder": "^3.0.0",
@@ -1,89 +1,102 @@
1
1
  /**
2
- * File: scripts/banner-injector.js
3
- * Description: Script to programmatically inject file-level banners into specified project files
4
- * Author: Ali Kahwaji
5
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
6
5
  */
7
6
 
8
7
  import fs from 'fs';
9
8
  import path from 'path';
10
- import glob from 'glob';
9
+ import { Octokit } from 'octokit';
10
+ import dotenv from 'dotenv';
11
11
 
12
- const banners = {
13
- '__tests__/unit/reranker/llm-reranker.test.js': `/**
14
- * File: __tests__/unit/reranker/llm-reranker.test.js
15
- * Description: Unit and integration tests with mocks for RAG pipeline
16
- * Author: Ali Kahwaji
17
- * Version: 1.0.4
18
- */\n\n`,
12
+ dotenv.config();
19
13
 
20
- '__tests__/unit/reranker/reranker.snapshot.test.js': `/**
21
- * File: __tests__/unit/reranker/reranker.snapshot.test.js
22
- * Description: Snapshot tests for LLM reranker
23
- * Author: Ali Kahwaji
24
- * Version: 1.0.4
25
- */\n\n`,
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');
26
21
 
27
- '__tests__/unit/core/plugin-registry.test.js': `/**
28
- * File: __tests__/unit/core/plugin-registry.test.js
29
- * Description: Unit and integration tests with mocks for RAG pipeline
30
- * Author: Ali Kahwaji
31
- * Version: 1.0.4
32
- */\n\n`,
22
+ if (!GITHUB_TOKEN || !GITHUB_REPO) {
23
+ console.error('❌ GITHUB_TOKEN and GITHUB_REPO must be defined in environment.');
24
+ process.exit(1);
25
+ }
33
26
 
34
- '__tests__/integration/config/load-config.test.js': `/**
35
- * File: __tests__/integration/config/load-config.test.js
36
- * Description: Unit and integration tests with mocks for RAG pipeline
37
- * Author: Ali Kahwaji
38
- * Version: 1.0.4
39
- */\n\n`,
27
+ const octokit = new Octokit({ auth: GITHUB_TOKEN });
40
28
 
41
- '__tests__/integration/cli/config-flow.test.js': `/**
42
- * File: __tests__/integration/cli/config-flow.test.js
43
- * Description: Unit and integration tests with mocks for RAG pipeline
44
- * Author: Ali Kahwaji
45
- * Version: 1.0.4
46
- */\n\n`,
29
+ /**
30
+ * Parse roadmap Markdown file into structured issue definitions
31
+ */
32
+ function parseRoadmapMarkdown(markdown) {
33
+ const lines = markdown.split('\n');
34
+ const issues = [];
47
35
 
48
- 'src/mocks/pdf-loader.js': `/**
49
- * File: src/mocks/pdf-loader.js
50
- * Description: Unit and integration tests with mocks for RAG pipeline
51
- * Author: Ali Kahwaji
52
- * Version: 1.0.4
53
- */\n\n`,
36
+ for (const line of lines) {
37
+ if (line.startsWith('|')) {
38
+ const cells = line.split('|').map(c => c.trim());
54
39
 
55
- 'src/mocks/openai-embedder.js': `/**
56
- * File: src/mocks/openai-embedder.js
57
- * Description: Unit and integration tests with mocks for RAG pipeline
58
- * Author: Ali Kahwaji
59
- * Version: 1.0.4
60
- */\n\n`,
40
+ if (cells.length < 6 || cells[0] === 'Phase') continue;
61
41
 
62
- 'src/mocks/pinecone-retriever.js': `/**
63
- * File: src/mocks/pinecone-retriever.js
64
- * Description: Unit and integration tests with mocks for RAG pipeline
65
- * Author: Ali Kahwaji
66
- * Version: 1.0.4
67
- */\n\n`
68
- };
69
-
70
- Object.entries(banners).forEach(([filePath, banner]) => {
71
- const resolvedPath = path.resolve(filePath);
42
+ const [, phase, priority, feature, group, tags] = cells;
72
43
 
73
- if (!fs.existsSync(resolvedPath)) {
74
- console.warn(`[SKIPPED] ${filePath} does not exist.`);
75
- return;
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
+ }
76
50
  }
77
51
 
78
- const originalContent = fs.readFileSync(resolvedPath, 'utf-8');
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
+ });
79
67
 
80
- // Skip if banner already present
81
- if (originalContent.startsWith('/**')) {
82
- console.log(`[SKIPPED] ${filePath} already contains a banner.`);
83
- return;
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);
84
99
  }
100
+ }
85
101
 
86
- const newContent = banner + originalContent;
87
- fs.writeFileSync(resolvedPath, newContent, 'utf-8');
88
- console.log(`[INJECTED] Banner added to ${filePath}`);
89
- });
102
+ main();
@@ -0,0 +1,65 @@
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
+ });