hale-commenting-system 3.1.0 → 3.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "hale-commenting-system",
3
- "version": "3.1.0",
3
+ "version": "3.2.0",
4
4
  "description": "A commenting system for PatternFly React applications that allows designers and developers to add comments directly on design pages, sync with GitHub Issues, and link Jira tickets.",
5
5
  "homepage": "https://www.npmjs.com/package/hale-commenting-system",
6
6
  "license": "MIT",
7
7
  "main": "src/app/commenting-system/index.ts",
8
8
  "types": "src/app/commenting-system/index.ts",
9
9
  "bin": {
10
- "hale-commenting-system": "./scripts/integrate.js"
10
+ "hale-commenting-system": "scripts/integrate.js"
11
11
  },
12
12
  "files": [
13
13
  "src/app/commenting-system/",
@@ -1359,13 +1359,114 @@ async function main() {
1359
1359
  }
1360
1360
  ]);
1361
1361
 
1362
+ // Ask for target repo to store comments/issues
1363
+ console.log('\nWhere do you want to store comments as GitHub Issues?');
1364
+ console.log('This should be a repository you have write access to.\n');
1365
+
1366
+ let targetOwner, targetRepo;
1367
+
1368
+ // Try to use gh CLI if available
1369
+ let ghAvailable = false;
1370
+ try {
1371
+ execSync('gh auth status', {
1372
+ stdio: 'ignore',
1373
+ timeout: 2000
1374
+ });
1375
+ ghAvailable = true;
1376
+ } catch {
1377
+ // gh CLI not available or not authenticated, will use manual entry
1378
+ }
1379
+
1380
+ if (ghAvailable) {
1381
+ const useGh = await prompt([
1382
+ {
1383
+ type: 'confirm',
1384
+ name: 'use',
1385
+ message: 'GitHub CLI (gh) detected. Would you like to select from your repositories?',
1386
+ default: true
1387
+ }
1388
+ ]);
1389
+
1390
+ if (useGh.use) {
1391
+ try {
1392
+ console.log(' Fetching your repositories...');
1393
+ const reposJson = execSync('gh repo list --json name,owner --limit 100', {
1394
+ encoding: 'utf-8',
1395
+ timeout: 10000,
1396
+ stdio: ['ignore', 'pipe', 'ignore']
1397
+ });
1398
+
1399
+ const repos = JSON.parse(reposJson);
1400
+
1401
+ if (repos && repos.length > 0) {
1402
+ const repoChoices = repos.map(r => ({
1403
+ name: `${r.owner.login}/${r.name}`,
1404
+ value: { owner: r.owner.login, repo: r.name }
1405
+ }));
1406
+
1407
+ // Add option to enter manually
1408
+ repoChoices.push({
1409
+ name: '→ Enter repository manually',
1410
+ value: null
1411
+ });
1412
+
1413
+ const selected = await prompt([
1414
+ {
1415
+ type: 'list',
1416
+ name: 'repo',
1417
+ message: 'Select a repository:',
1418
+ choices: repoChoices
1419
+ }
1420
+ ]);
1421
+
1422
+ if (selected.repo) {
1423
+ targetOwner = selected.repo.owner;
1424
+ targetRepo = selected.repo.repo;
1425
+ console.log(` ✓ Selected: ${targetOwner}/${targetRepo}\n`);
1426
+ }
1427
+ } else {
1428
+ console.log(' No repositories found. Using manual entry.\n');
1429
+ }
1430
+ } catch (error) {
1431
+ console.log(' ⚠️ Error fetching repositories. Using manual entry.\n');
1432
+ }
1433
+ }
1434
+ }
1435
+
1436
+ // Manual entry if gh CLI not used or failed
1437
+ if (!targetOwner || !targetRepo) {
1438
+ const repoAnswers = await prompt([
1439
+ {
1440
+ type: 'input',
1441
+ name: 'owner',
1442
+ message: 'GitHub repository owner (username or organization):',
1443
+ validate: (input) => {
1444
+ if (!input.trim()) return 'Owner is required';
1445
+ return true;
1446
+ }
1447
+ },
1448
+ {
1449
+ type: 'input',
1450
+ name: 'repo',
1451
+ message: 'GitHub repository name:',
1452
+ validate: (input) => {
1453
+ if (!input.trim()) return 'Repository name is required';
1454
+ return true;
1455
+ }
1456
+ }
1457
+ ]);
1458
+
1459
+ targetOwner = repoAnswers.owner;
1460
+ targetRepo = repoAnswers.repo;
1461
+ }
1462
+
1362
1463
  // Validate GitHub credentials
1363
1464
  console.log('\n🔍 Validating GitHub credentials...');
1364
1465
  githubValid = await validateGitHubCredentials(
1365
1466
  githubAnswers.clientId,
1366
1467
  githubAnswers.clientSecret,
1367
- owner,
1368
- repo
1468
+ targetOwner,
1469
+ targetRepo
1369
1470
  );
1370
1471
 
1371
1472
  if (!githubValid) {
@@ -1378,8 +1479,8 @@ async function main() {
1378
1479
  githubConfig = {
1379
1480
  clientId: githubAnswers.clientId,
1380
1481
  clientSecret: githubAnswers.clientSecret,
1381
- owner: owner,
1382
- repo: repo
1482
+ owner: targetOwner,
1483
+ repo: targetRepo
1383
1484
  };
1384
1485
  } else {
1385
1486
  console.log('\n⏭️ Skipping GitHub setup. You can add it later by editing .env and .env.server files.\n');
@@ -1469,8 +1570,8 @@ async function main() {
1469
1570
  generateFiles({
1470
1571
  github: githubConfig,
1471
1572
  jira: jiraConfig,
1472
- owner: owner,
1473
- repo: repo
1573
+ owner: githubConfig ? githubConfig.owner : owner,
1574
+ repo: githubConfig ? githubConfig.repo : repo
1474
1575
  });
1475
1576
 
1476
1577
  // Step 5: Integrate into project