chiefwiggum 1.3.41 → 1.3.42
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 +98 -7
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -1402,12 +1402,42 @@ Create 5-15 issues.${projectName ? ` Add each to project "${projectName}".` : ""
|
|
|
1402
1402
|
}
|
|
1403
1403
|
if (!usedFallback) {
|
|
1404
1404
|
const total = issues.length;
|
|
1405
|
-
|
|
1405
|
+
const owner = repoName.split("/")[0];
|
|
1406
|
+
console.log(import_picocolors7.default.dim(" Creating epic from PRD..."));
|
|
1407
|
+
const prdTitleMatch = prdGenerated.match(/^#\s+(.+)$/m);
|
|
1408
|
+
const epicTitle = prdTitleMatch ? `Epic: ${prdTitleMatch[1]}` : "Epic: Project Implementation";
|
|
1409
|
+
const epicBodyInitial = `${prdGenerated}
|
|
1410
|
+
|
|
1411
|
+
---
|
|
1412
|
+
|
|
1413
|
+
## Tasks
|
|
1414
|
+
|
|
1415
|
+
_Creating issues..._
|
|
1416
|
+
`;
|
|
1417
|
+
let epicNumber = null;
|
|
1418
|
+
let epicUrl = null;
|
|
1419
|
+
try {
|
|
1420
|
+
const escapeForShell = (str) => {
|
|
1421
|
+
return str.replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/`/g, "\\`").replace(/\$/g, "\\$").replace(/!/g, "\\!").replace(/\n/g, "\\n");
|
|
1422
|
+
};
|
|
1423
|
+
const epicCmd = `gh issue create --title "${escapeForShell(epicTitle)}" --body "${escapeForShell(epicBodyInitial)}" --label "epic,chiefwiggum"`;
|
|
1424
|
+
epicUrl = (0, import_node_child_process6.execSync)(epicCmd, {
|
|
1425
|
+
encoding: "utf-8",
|
|
1426
|
+
stdio: ["pipe", "pipe", "pipe"]
|
|
1427
|
+
}).trim();
|
|
1428
|
+
const epicNumMatch = epicUrl.match(/\/issues\/(\d+)$/);
|
|
1429
|
+
epicNumber = epicNumMatch ? parseInt(epicNumMatch[1], 10) : null;
|
|
1430
|
+
if (epicNumber) {
|
|
1431
|
+
console.log(import_picocolors7.default.green(` \u2713 Created epic #${epicNumber}`));
|
|
1432
|
+
}
|
|
1433
|
+
} catch {
|
|
1434
|
+
console.log(import_picocolors7.default.yellow(" Could not create epic issue. Continuing without parent tracking..."));
|
|
1435
|
+
}
|
|
1436
|
+
console.log(import_picocolors7.default.dim(` Creating ${total} child issues...`));
|
|
1406
1437
|
let projectNumber = null;
|
|
1407
1438
|
let projectId = null;
|
|
1408
1439
|
let statusFieldId = null;
|
|
1409
1440
|
let todoOptionId = null;
|
|
1410
|
-
const owner = repoName.split("/")[0];
|
|
1411
1441
|
if (projectName) {
|
|
1412
1442
|
try {
|
|
1413
1443
|
const projectsOutput = (0, import_node_child_process6.execSync)(
|
|
@@ -1453,6 +1483,15 @@ Create 5-15 issues.${projectName ? ` Add each to project "${projectName}".` : ""
|
|
|
1453
1483
|
} catch {
|
|
1454
1484
|
}
|
|
1455
1485
|
}
|
|
1486
|
+
if (epicUrl && projectNumber) {
|
|
1487
|
+
try {
|
|
1488
|
+
(0, import_node_child_process6.execSync)(
|
|
1489
|
+
`gh project item-add ${projectNumber} --owner ${owner} --url "${epicUrl}"`,
|
|
1490
|
+
{ stdio: ["pipe", "pipe", "pipe"] }
|
|
1491
|
+
);
|
|
1492
|
+
} catch {
|
|
1493
|
+
}
|
|
1494
|
+
}
|
|
1456
1495
|
let availableLabels = /* @__PURE__ */ new Set();
|
|
1457
1496
|
try {
|
|
1458
1497
|
const labelsOutput = (0, import_node_child_process6.execSync)("gh label list --json name --jq '.[].name'", {
|
|
@@ -1467,11 +1506,16 @@ Create 5-15 issues.${projectName ? ` Add each to project "${projectName}".` : ""
|
|
|
1467
1506
|
`gh label create chiefwiggum --description "Created by Chief Wiggum CLI" --color "FFA500" 2>/dev/null || true`,
|
|
1468
1507
|
{ stdio: ["pipe", "pipe", "pipe"] }
|
|
1469
1508
|
);
|
|
1509
|
+
(0, import_node_child_process6.execSync)(
|
|
1510
|
+
`gh label create epic --description "Parent tracking issue" --color "6366F1" 2>/dev/null || true`,
|
|
1511
|
+
{ stdio: ["pipe", "pipe", "pipe"] }
|
|
1512
|
+
);
|
|
1470
1513
|
} catch {
|
|
1471
1514
|
}
|
|
1472
1515
|
let created = 0;
|
|
1473
1516
|
let failed = 0;
|
|
1474
1517
|
const failedIssues = [];
|
|
1518
|
+
const createdIssueNumbers = [];
|
|
1475
1519
|
for (let i = 0; i < issues.length; i++) {
|
|
1476
1520
|
const issue = issues[i];
|
|
1477
1521
|
const progress = Math.round((i + 1) / total * 100);
|
|
@@ -1487,13 +1531,25 @@ Create 5-15 issues.${projectName ? ` Add each to project "${projectName}".` : ""
|
|
|
1487
1531
|
const escapeForShell = (str) => {
|
|
1488
1532
|
return str.replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/`/g, "\\`").replace(/\$/g, "\\$").replace(/!/g, "\\!").replace(/\n/g, "\\n");
|
|
1489
1533
|
};
|
|
1490
|
-
|
|
1534
|
+
let bodyWithEpic = issue.body;
|
|
1535
|
+
if (epicNumber) {
|
|
1536
|
+
bodyWithEpic = `Part of #${epicNumber}
|
|
1537
|
+
|
|
1538
|
+
---
|
|
1539
|
+
|
|
1540
|
+
${issue.body}`;
|
|
1541
|
+
}
|
|
1542
|
+
const body = escapeForShell(bodyWithEpic);
|
|
1491
1543
|
const title = escapeForShell(issue.title);
|
|
1492
1544
|
const createCmd = `gh issue create --title "${title}" --body "${body}" ${labelsArg}`;
|
|
1493
1545
|
const issueUrl = (0, import_node_child_process6.execSync)(createCmd, {
|
|
1494
1546
|
encoding: "utf-8",
|
|
1495
1547
|
stdio: ["pipe", "pipe", "pipe"]
|
|
1496
1548
|
}).trim();
|
|
1549
|
+
const issueNumMatch = issueUrl.match(/\/issues\/(\d+)$/);
|
|
1550
|
+
if (issueNumMatch) {
|
|
1551
|
+
createdIssueNumbers.push(parseInt(issueNumMatch[1], 10));
|
|
1552
|
+
}
|
|
1497
1553
|
if (projectNumber && issueUrl) {
|
|
1498
1554
|
try {
|
|
1499
1555
|
const addOutput = (0, import_node_child_process6.execSync)(
|
|
@@ -1542,6 +1598,28 @@ Create 5-15 issues.${projectName ? ` Add each to project "${projectName}".` : ""
|
|
|
1542
1598
|
console.log(import_picocolors7.default.green(` \u2713 Added to board "${projectName}"`));
|
|
1543
1599
|
}
|
|
1544
1600
|
}
|
|
1601
|
+
if (epicNumber && createdIssueNumbers.length > 0) {
|
|
1602
|
+
const escapeForShell = (str) => {
|
|
1603
|
+
return str.replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/`/g, "\\`").replace(/\$/g, "\\$").replace(/!/g, "\\!").replace(/\n/g, "\\n");
|
|
1604
|
+
};
|
|
1605
|
+
const tasklist = createdIssueNumbers.map((num) => `- [ ] #${num}`).join("\n");
|
|
1606
|
+
const updatedEpicBody = `${prdGenerated}
|
|
1607
|
+
|
|
1608
|
+
---
|
|
1609
|
+
|
|
1610
|
+
## Tasks
|
|
1611
|
+
|
|
1612
|
+
${tasklist}`;
|
|
1613
|
+
try {
|
|
1614
|
+
(0, import_node_child_process6.execSync)(
|
|
1615
|
+
`gh issue edit ${epicNumber} --body "${escapeForShell(updatedEpicBody)}"`,
|
|
1616
|
+
{ stdio: ["pipe", "pipe", "pipe"] }
|
|
1617
|
+
);
|
|
1618
|
+
console.log(import_picocolors7.default.green(` \u2713 Updated epic #${epicNumber} with tasklist`));
|
|
1619
|
+
} catch {
|
|
1620
|
+
console.log(import_picocolors7.default.yellow(` Could not update epic with tasklist`));
|
|
1621
|
+
}
|
|
1622
|
+
}
|
|
1545
1623
|
} else {
|
|
1546
1624
|
console.log(import_picocolors7.default.green(" \u2713 GitHub Issues created"));
|
|
1547
1625
|
if (projectName) {
|
|
@@ -1801,7 +1879,7 @@ async function cleanGitHubIssues() {
|
|
|
1801
1879
|
let issues = [];
|
|
1802
1880
|
try {
|
|
1803
1881
|
const output = (0, import_node_child_process7.execSync)(
|
|
1804
|
-
`gh issue list --label chiefwiggum --state open --json number,title,createdAt --limit 100`,
|
|
1882
|
+
`gh issue list --label chiefwiggum --state open --json number,title,createdAt,labels --limit 100`,
|
|
1805
1883
|
{ encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] }
|
|
1806
1884
|
);
|
|
1807
1885
|
issues = JSON.parse(output);
|
|
@@ -1813,10 +1891,22 @@ async function cleanGitHubIssues() {
|
|
|
1813
1891
|
console.log(import_picocolors8.default.dim("No open issues with 'chiefwiggum' label found."));
|
|
1814
1892
|
return;
|
|
1815
1893
|
}
|
|
1894
|
+
const isEpic = (i) => i.labels.some((l) => l.name === "epic");
|
|
1895
|
+
const epics = issues.filter(isEpic);
|
|
1896
|
+
const childIssues = issues.filter((i) => !isEpic(i));
|
|
1816
1897
|
console.log();
|
|
1817
1898
|
console.log(`Found ${issues.length} issues with 'chiefwiggum' label:`);
|
|
1818
|
-
|
|
1819
|
-
console.log(
|
|
1899
|
+
if (epics.length > 0) {
|
|
1900
|
+
console.log(import_picocolors8.default.dim(" Epics:"));
|
|
1901
|
+
for (const issue of epics) {
|
|
1902
|
+
console.log(` ${import_picocolors8.default.magenta(`#${issue.number}`)} ${import_picocolors8.default.bold("\u{1F4CB}")} ${issue.title}`);
|
|
1903
|
+
}
|
|
1904
|
+
}
|
|
1905
|
+
if (childIssues.length > 0) {
|
|
1906
|
+
console.log(import_picocolors8.default.dim(" Tasks:"));
|
|
1907
|
+
for (const issue of childIssues) {
|
|
1908
|
+
console.log(` ${import_picocolors8.default.cyan(`#${issue.number}`)} - ${issue.title}`);
|
|
1909
|
+
}
|
|
1820
1910
|
}
|
|
1821
1911
|
console.log();
|
|
1822
1912
|
const action = await select2({
|
|
@@ -1836,7 +1926,8 @@ async function cleanGitHubIssues() {
|
|
|
1836
1926
|
message: "Select issues to remove (space to toggle, enter to confirm)",
|
|
1837
1927
|
options: issues.map((i) => ({
|
|
1838
1928
|
value: String(i.number),
|
|
1839
|
-
label: `#${i.number} - ${i.title}
|
|
1929
|
+
label: isEpic(i) ? `\u{1F4CB} #${i.number} - ${i.title}` : `#${i.number} - ${i.title}`,
|
|
1930
|
+
hint: isEpic(i) ? "epic" : void 0
|
|
1840
1931
|
}))
|
|
1841
1932
|
});
|
|
1842
1933
|
if (selected.length === 0) {
|