chiefwiggum 1.3.45 → 1.3.48
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/dist/cli.cjs +69 -43
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -1423,9 +1423,20 @@ Create 5-15 issues.${projectName ? ` Add each to project "${projectName}".` : ""
|
|
|
1423
1423
|
if (!usedFallback) {
|
|
1424
1424
|
const total = issues.length;
|
|
1425
1425
|
const owner = repoName.split("/")[0];
|
|
1426
|
+
try {
|
|
1427
|
+
(0, import_node_child_process6.execSync)(
|
|
1428
|
+
`gh label create chiefwiggum --description "Created by Chief Wiggum CLI" --color "FFA500" 2>/dev/null || true`,
|
|
1429
|
+
{ stdio: ["pipe", "pipe", "pipe"] }
|
|
1430
|
+
);
|
|
1431
|
+
(0, import_node_child_process6.execSync)(
|
|
1432
|
+
`gh label create epic --description "Parent tracking issue" --color "6366F1" 2>/dev/null || true`,
|
|
1433
|
+
{ stdio: ["pipe", "pipe", "pipe"] }
|
|
1434
|
+
);
|
|
1435
|
+
} catch {
|
|
1436
|
+
}
|
|
1426
1437
|
console.log(import_picocolors7.default.dim(" Creating epic from PRD..."));
|
|
1427
|
-
const
|
|
1428
|
-
const epicTitle =
|
|
1438
|
+
const planTitleMatch = planContent.match(/^#\s+(.+)$/m);
|
|
1439
|
+
const epicTitle = planTitleMatch ? `Epic: ${planTitleMatch[1]}` : "Epic: Project Implementation";
|
|
1429
1440
|
const epicBodyInitial = `${prdGenerated}
|
|
1430
1441
|
|
|
1431
1442
|
---
|
|
@@ -1437,21 +1448,34 @@ _Creating issues..._
|
|
|
1437
1448
|
let epicNumber = null;
|
|
1438
1449
|
let epicUrl = null;
|
|
1439
1450
|
try {
|
|
1440
|
-
const
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1451
|
+
const result2 = (0, import_node_child_process6.spawnSync)("gh", [
|
|
1452
|
+
"issue",
|
|
1453
|
+
"create",
|
|
1454
|
+
"--title",
|
|
1455
|
+
epicTitle,
|
|
1456
|
+
"--body",
|
|
1457
|
+
epicBodyInitial,
|
|
1458
|
+
"--label",
|
|
1459
|
+
"epic,chiefwiggum"
|
|
1460
|
+
], {
|
|
1445
1461
|
encoding: "utf-8",
|
|
1446
1462
|
stdio: ["pipe", "pipe", "pipe"]
|
|
1447
|
-
})
|
|
1463
|
+
});
|
|
1464
|
+
if (result2.status !== 0) {
|
|
1465
|
+
throw new Error(result2.stderr || "Failed to create epic");
|
|
1466
|
+
}
|
|
1467
|
+
epicUrl = result2.stdout.trim();
|
|
1448
1468
|
const epicNumMatch = epicUrl.match(/\/issues\/(\d+)$/);
|
|
1449
1469
|
epicNumber = epicNumMatch ? parseInt(epicNumMatch[1], 10) : null;
|
|
1450
1470
|
if (epicNumber) {
|
|
1451
1471
|
console.log(import_picocolors7.default.green(` \u2713 Created epic #${epicNumber}`));
|
|
1452
1472
|
}
|
|
1453
|
-
} catch {
|
|
1473
|
+
} catch (err) {
|
|
1454
1474
|
console.log(import_picocolors7.default.yellow(" Could not create epic issue. Continuing without parent tracking..."));
|
|
1475
|
+
const errMsg = err instanceof Error ? err.message : String(err);
|
|
1476
|
+
if (errMsg) {
|
|
1477
|
+
console.log(import_picocolors7.default.dim(` ${errMsg.slice(0, 100)}`));
|
|
1478
|
+
}
|
|
1455
1479
|
}
|
|
1456
1480
|
console.log(import_picocolors7.default.dim(` Creating ${total} child issues...`));
|
|
1457
1481
|
let projectNumber = null;
|
|
@@ -1521,36 +1545,22 @@ _Creating issues..._
|
|
|
1521
1545
|
availableLabels = new Set(labelsOutput.trim().split("\n").filter(Boolean));
|
|
1522
1546
|
} catch {
|
|
1523
1547
|
}
|
|
1524
|
-
try {
|
|
1525
|
-
(0, import_node_child_process6.execSync)(
|
|
1526
|
-
`gh label create chiefwiggum --description "Created by Chief Wiggum CLI" --color "FFA500" 2>/dev/null || true`,
|
|
1527
|
-
{ stdio: ["pipe", "pipe", "pipe"] }
|
|
1528
|
-
);
|
|
1529
|
-
(0, import_node_child_process6.execSync)(
|
|
1530
|
-
`gh label create epic --description "Parent tracking issue" --color "6366F1" 2>/dev/null || true`,
|
|
1531
|
-
{ stdio: ["pipe", "pipe", "pipe"] }
|
|
1532
|
-
);
|
|
1533
|
-
} catch {
|
|
1534
|
-
}
|
|
1535
1548
|
let created = 0;
|
|
1536
1549
|
let failed = 0;
|
|
1537
1550
|
const failedIssues = [];
|
|
1538
1551
|
const createdIssueNumbers = [];
|
|
1552
|
+
const loggedMilestones = /* @__PURE__ */ new Set();
|
|
1539
1553
|
for (let i = 0; i < issues.length; i++) {
|
|
1540
1554
|
const issue = issues[i];
|
|
1541
1555
|
const progress = Math.round((i + 1) / total * 100);
|
|
1542
|
-
const
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1556
|
+
const milestone = Math.floor(progress / 25) * 25;
|
|
1557
|
+
if (milestone > 0 && !loggedMilestones.has(milestone) && milestone < 100) {
|
|
1558
|
+
console.log(import_picocolors7.default.dim(` ${milestone}% complete (${i + 1}/${total})...`));
|
|
1559
|
+
loggedMilestones.add(milestone);
|
|
1560
|
+
}
|
|
1547
1561
|
try {
|
|
1548
1562
|
const validLabels = issue.labels.filter((label) => availableLabels.size === 0 || availableLabels.has(label));
|
|
1549
1563
|
const allLabels = ["chiefwiggum", ...validLabels];
|
|
1550
|
-
const labelsArg = `--label "${allLabels.join(",")}"`;
|
|
1551
|
-
const escapeForShell = (str) => {
|
|
1552
|
-
return str.replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/`/g, "\\`").replace(/\$/g, "\\$").replace(/!/g, "\\!").replace(/\n/g, "\\n");
|
|
1553
|
-
};
|
|
1554
1564
|
let bodyWithEpic = issue.body;
|
|
1555
1565
|
if (epicNumber) {
|
|
1556
1566
|
bodyWithEpic = `Part of #${epicNumber}
|
|
@@ -1559,13 +1569,23 @@ _Creating issues..._
|
|
|
1559
1569
|
|
|
1560
1570
|
${issue.body}`;
|
|
1561
1571
|
}
|
|
1562
|
-
const
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1572
|
+
const createResult = (0, import_node_child_process6.spawnSync)("gh", [
|
|
1573
|
+
"issue",
|
|
1574
|
+
"create",
|
|
1575
|
+
"--title",
|
|
1576
|
+
issue.title,
|
|
1577
|
+
"--body",
|
|
1578
|
+
bodyWithEpic,
|
|
1579
|
+
"--label",
|
|
1580
|
+
allLabels.join(",")
|
|
1581
|
+
], {
|
|
1566
1582
|
encoding: "utf-8",
|
|
1567
1583
|
stdio: ["pipe", "pipe", "pipe"]
|
|
1568
|
-
})
|
|
1584
|
+
});
|
|
1585
|
+
if (createResult.status !== 0) {
|
|
1586
|
+
throw new Error(createResult.stderr || "Failed to create issue");
|
|
1587
|
+
}
|
|
1588
|
+
const issueUrl = createResult.stdout.trim();
|
|
1569
1589
|
const issueNumMatch = issueUrl.match(/\/issues\/(\d+)$/);
|
|
1570
1590
|
if (issueNumMatch) {
|
|
1571
1591
|
createdIssueNumbers.push(parseInt(issueNumMatch[1], 10));
|
|
@@ -1599,7 +1619,6 @@ ${issue.body}`;
|
|
|
1599
1619
|
failedIssues.push({ title: issue.title, error: errorMsg });
|
|
1600
1620
|
}
|
|
1601
1621
|
}
|
|
1602
|
-
process.stdout.write("\r" + " ".repeat(100) + "\r");
|
|
1603
1622
|
console.log(import_picocolors7.default.green(` \u2713 Created ${created} GitHub Issues`));
|
|
1604
1623
|
if (failed > 0) {
|
|
1605
1624
|
console.log(import_picocolors7.default.yellow(` \u26A0 ${failed} issues failed to create:`));
|
|
@@ -1619,9 +1638,6 @@ ${issue.body}`;
|
|
|
1619
1638
|
}
|
|
1620
1639
|
}
|
|
1621
1640
|
if (epicNumber && createdIssueNumbers.length > 0) {
|
|
1622
|
-
const escapeForShell = (str) => {
|
|
1623
|
-
return str.replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/`/g, "\\`").replace(/\$/g, "\\$").replace(/!/g, "\\!").replace(/\n/g, "\\n");
|
|
1624
|
-
};
|
|
1625
1641
|
const tasklist = createdIssueNumbers.map((num) => `- [ ] #${num}`).join("\n");
|
|
1626
1642
|
const updatedEpicBody = `${prdGenerated}
|
|
1627
1643
|
|
|
@@ -1631,11 +1647,21 @@ ${issue.body}`;
|
|
|
1631
1647
|
|
|
1632
1648
|
${tasklist}`;
|
|
1633
1649
|
try {
|
|
1634
|
-
(0, import_node_child_process6.
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1650
|
+
const editResult = (0, import_node_child_process6.spawnSync)("gh", [
|
|
1651
|
+
"issue",
|
|
1652
|
+
"edit",
|
|
1653
|
+
String(epicNumber),
|
|
1654
|
+
"--body",
|
|
1655
|
+
updatedEpicBody
|
|
1656
|
+
], {
|
|
1657
|
+
encoding: "utf-8",
|
|
1658
|
+
stdio: ["pipe", "pipe", "pipe"]
|
|
1659
|
+
});
|
|
1660
|
+
if (editResult.status === 0) {
|
|
1661
|
+
console.log(import_picocolors7.default.green(` \u2713 Updated epic #${epicNumber} with tasklist`));
|
|
1662
|
+
} else {
|
|
1663
|
+
throw new Error(editResult.stderr || "Failed");
|
|
1664
|
+
}
|
|
1639
1665
|
} catch {
|
|
1640
1666
|
console.log(import_picocolors7.default.yellow(` Could not update epic with tasklist`));
|
|
1641
1667
|
}
|