hale-commenting-system 3.1.1 → 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 +1 -1
- package/scripts/integrate.js +92 -21
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hale-commenting-system",
|
|
3
|
-
"version": "3.
|
|
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",
|
package/scripts/integrate.js
CHANGED
|
@@ -1363,31 +1363,102 @@ async function main() {
|
|
|
1363
1363
|
console.log('\nWhere do you want to store comments as GitHub Issues?');
|
|
1364
1364
|
console.log('This should be a repository you have write access to.\n');
|
|
1365
1365
|
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
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
|
|
1375
1387
|
}
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
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');
|
|
1385
1432
|
}
|
|
1386
1433
|
}
|
|
1387
|
-
|
|
1434
|
+
}
|
|
1388
1435
|
|
|
1389
|
-
|
|
1390
|
-
|
|
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
|
+
}
|
|
1391
1462
|
|
|
1392
1463
|
// Validate GitHub credentials
|
|
1393
1464
|
console.log('\n🔍 Validating GitHub credentials...');
|