@devilsdev/rag-pipeline-utils 2.1.4 → 2.1.5

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.
@@ -0,0 +1,71 @@
1
+ /**
2
+ * Version: 1.1.0
3
+ * Description: Syncs GitHub labels based on roadmap-labels.yml; updates existing, creates missing.
4
+ * Author: Ali Kahwaji
5
+ */
6
+
7
+ import fs from 'fs';
8
+ import path from 'path';
9
+ import yaml from 'js-yaml';
10
+ import { Octokit } from '@octokit/rest';
11
+
12
+ const GITHUB_TOKEN = process.env.GITHUB_TOKEN;
13
+ const REPO = process.env.GITHUB_REPOSITORY;
14
+
15
+ if (!GITHUB_TOKEN || !REPO) {
16
+ console.error('❌ GITHUB_TOKEN or GITHUB_REPOSITORY not defined in environment.');
17
+ process.exit(1);
18
+ }
19
+
20
+ const [owner, repo] = REPO.split('/');
21
+ const octokit = new Octokit({ auth: GITHUB_TOKEN });
22
+
23
+ const LABELS_FILE = path.join('.github', 'roadmap-labels.yml');
24
+
25
+ function loadLabelsFromYAML(filePath) {
26
+ try {
27
+ const file = fs.readFileSync(filePath, 'utf8');
28
+ return yaml.load(file);
29
+ } catch (err) {
30
+ console.error('❌ Failed to load roadmap-labels.yml:', err);
31
+ process.exit(1);
32
+ }
33
+ }
34
+
35
+ async function syncLabels() {
36
+ const labels = loadLabelsFromYAML(LABELS_FILE);
37
+ const existingLabels = await octokit.paginate(octokit.rest.issues.listLabelsForRepo, {
38
+ owner,
39
+ repo,
40
+ });
41
+
42
+ for (const label of labels) {
43
+ const existing = existingLabels.find(l => l.name === label.name);
44
+
45
+ try {
46
+ if (existing) {
47
+ console.log(`🔁 Updating label: ${label.name}`);
48
+ await octokit.rest.issues.updateLabel({
49
+ owner,
50
+ repo,
51
+ name: label.name,
52
+ color: label.color,
53
+ description: label.description,
54
+ });
55
+ } else {
56
+ console.log(`➕ Creating label: ${label.name}`);
57
+ await octokit.rest.issues.createLabel({
58
+ owner,
59
+ repo,
60
+ name: label.name,
61
+ color: label.color,
62
+ description: label.description,
63
+ });
64
+ }
65
+ } catch (err) {
66
+ console.error(`❌ Failed to process label: ${label.name}`, err.message);
67
+ }
68
+ }
69
+ }
70
+
71
+ syncLabels();
@@ -0,0 +1,21 @@
1
+ // scripts/sync-roadmap-labels.js
2
+
3
+ /**
4
+ * Version: 1.1.0
5
+ * Description: Sync roadmap labels and issues
6
+ * Author: Ali Kahwaji
7
+ */
8
+
9
+ import { ensureRoadmapLabels } from './ensure-roadmap-labels.js';
10
+ import { createRoadmapIssues } from './create-roadmap-issues.js';
11
+
12
+ const [owner, repo] = process.env.GITHUB_REPOSITORY.split('/');
13
+ const token = process.env.GITHUB_TOKEN;
14
+
15
+ if (!token) {
16
+ console.error('❌ Missing GITHUB_TOKEN');
17
+ process.exit(1);
18
+ }
19
+
20
+ await ensureRoadmapLabels({ token, owner, repo });
21
+ await createRoadmapIssues({ token, owner, repo });
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Version: 2.0.0
3
+ * Description: Tags release, updates changelog, optionally opens blog preview
4
+ * Author: Ali Kahwaji
5
+ */
6
+
7
+ import fs from 'fs';
8
+ import path from 'path';
9
+ import { execSync } from 'child_process';
10
+ import readline from 'readline';
11
+
12
+ const VERSION = process.argv[2];
13
+ const PREVIEW = process.argv.includes('--preview');
14
+
15
+ if (!VERSION) {
16
+ console.error('❌ Usage: node release-tag.js <version> [--preview]');
17
+ process.exit(1);
18
+ }
19
+
20
+ const tag = `v${VERSION}`;
21
+ const blogPath = path.join('docs-site', 'blog');
22
+
23
+ // Step 1: Run changelog injection
24
+ execSync(`node scripts/generate-release-note.js ${VERSION}`, { stdio: 'inherit' });
25
+
26
+ // Step 2: Find generated blog file
27
+ const date = new Date().toISOString().split('T')[0];
28
+ const file = path.join(blogPath, `${date}-release-${tag}.md`);
29
+
30
+ if (!fs.existsSync(file)) {
31
+ console.error(`❌ Blog post not generated: ${file}`);
32
+ process.exit(1);
33
+ }
34
+
35
+ // Step 3: Preview if enabled
36
+ if (PREVIEW) {
37
+ const editor = process.env.EDITOR || 'code'; // fallback to VS Code
38
+ try {
39
+ execSync(`${editor} ${file}`, { stdio: 'inherit' });
40
+ } catch (err) {
41
+ console.warn('⚠️ Failed to open in editor. Please review manually:', file);
42
+ }
43
+
44
+ const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
45
+ rl.question(`✅ Ready to commit and push ${tag}? (y/n): `, (answer) => {
46
+ rl.close();
47
+ if (answer.toLowerCase() !== 'y') {
48
+ console.log('❌ Aborted. No tag pushed.');
49
+ process.exit(0);
50
+ }
51
+ finalizeRelease();
52
+ });
53
+ } else {
54
+ finalizeRelease();
55
+ }
56
+
57
+ // Final tagging + push
58
+ function finalizeRelease() {
59
+ execSync(`git add CHANGELOG.md ${file}`);
60
+ execSync(`git commit -m "release: v${VERSION}"`);
61
+ execSync(`git tag ${tag}`);
62
+ execSync('git push && git push --tags');
63
+ console.log(`🎉 Release ${tag} published and blog post staged!`);
64
+ }