chiefwiggum 1.3.39 → 1.3.41
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 +177 -17
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -95,6 +95,14 @@ async function multilineText(options) {
|
|
|
95
95
|
});
|
|
96
96
|
});
|
|
97
97
|
}
|
|
98
|
+
async function multiselect2(options) {
|
|
99
|
+
const result = await p.multiselect({
|
|
100
|
+
message: options.message,
|
|
101
|
+
options: options.options,
|
|
102
|
+
required: options.required ?? false
|
|
103
|
+
});
|
|
104
|
+
return handleCancel(result);
|
|
105
|
+
}
|
|
98
106
|
async function searchSelect(options) {
|
|
99
107
|
const { message, items, placeholder = "Type to filter...", maxVisible = 10 } = options;
|
|
100
108
|
const readline = await import("readline");
|
|
@@ -1396,10 +1404,14 @@ Create 5-15 issues.${projectName ? ` Add each to project "${projectName}".` : ""
|
|
|
1396
1404
|
const total = issues.length;
|
|
1397
1405
|
console.log(import_picocolors7.default.dim(` Creating ${total} issues...`));
|
|
1398
1406
|
let projectNumber = null;
|
|
1407
|
+
let projectId = null;
|
|
1408
|
+
let statusFieldId = null;
|
|
1409
|
+
let todoOptionId = null;
|
|
1410
|
+
const owner = repoName.split("/")[0];
|
|
1399
1411
|
if (projectName) {
|
|
1400
1412
|
try {
|
|
1401
1413
|
const projectsOutput = (0, import_node_child_process6.execSync)(
|
|
1402
|
-
`gh project list --owner ${
|
|
1414
|
+
`gh project list --owner ${owner} --format json`,
|
|
1403
1415
|
{ encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] }
|
|
1404
1416
|
);
|
|
1405
1417
|
const projects = JSON.parse(projectsOutput);
|
|
@@ -1408,11 +1420,35 @@ Create 5-15 issues.${projectName ? ` Add each to project "${projectName}".` : ""
|
|
|
1408
1420
|
if (projectNumber) {
|
|
1409
1421
|
try {
|
|
1410
1422
|
(0, import_node_child_process6.execSync)(
|
|
1411
|
-
`gh project link ${projectNumber} --owner ${
|
|
1423
|
+
`gh project link ${projectNumber} --owner ${owner} --repo ${repoName}`,
|
|
1412
1424
|
{ stdio: ["pipe", "pipe", "pipe"] }
|
|
1413
1425
|
);
|
|
1414
1426
|
} catch {
|
|
1415
1427
|
}
|
|
1428
|
+
try {
|
|
1429
|
+
const repoProjectsOutput = (0, import_node_child_process6.execSync)(
|
|
1430
|
+
`gh repo view --json projectsV2 -q '.projectsV2.Nodes[] | select(.number == ${projectNumber}) | .id'`,
|
|
1431
|
+
{ encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] }
|
|
1432
|
+
);
|
|
1433
|
+
projectId = repoProjectsOutput.trim() || null;
|
|
1434
|
+
} catch {
|
|
1435
|
+
}
|
|
1436
|
+
if (projectId) {
|
|
1437
|
+
try {
|
|
1438
|
+
const fieldsOutput = (0, import_node_child_process6.execSync)(
|
|
1439
|
+
`gh project field-list ${projectNumber} --owner ${owner} --format json`,
|
|
1440
|
+
{ encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] }
|
|
1441
|
+
);
|
|
1442
|
+
const fields = JSON.parse(fieldsOutput);
|
|
1443
|
+
const statusField = fields.fields?.find((f) => f.name === "Status");
|
|
1444
|
+
if (statusField) {
|
|
1445
|
+
statusFieldId = statusField.id;
|
|
1446
|
+
const todoOption = statusField.options?.find((o) => o.name === "Todo");
|
|
1447
|
+
todoOptionId = todoOption?.id || null;
|
|
1448
|
+
}
|
|
1449
|
+
} catch {
|
|
1450
|
+
}
|
|
1451
|
+
}
|
|
1416
1452
|
}
|
|
1417
1453
|
} catch {
|
|
1418
1454
|
}
|
|
@@ -1426,6 +1462,13 @@ Create 5-15 issues.${projectName ? ` Add each to project "${projectName}".` : ""
|
|
|
1426
1462
|
availableLabels = new Set(labelsOutput.trim().split("\n").filter(Boolean));
|
|
1427
1463
|
} catch {
|
|
1428
1464
|
}
|
|
1465
|
+
try {
|
|
1466
|
+
(0, import_node_child_process6.execSync)(
|
|
1467
|
+
`gh label create chiefwiggum --description "Created by Chief Wiggum CLI" --color "FFA500" 2>/dev/null || true`,
|
|
1468
|
+
{ stdio: ["pipe", "pipe", "pipe"] }
|
|
1469
|
+
);
|
|
1470
|
+
} catch {
|
|
1471
|
+
}
|
|
1429
1472
|
let created = 0;
|
|
1430
1473
|
let failed = 0;
|
|
1431
1474
|
const failedIssues = [];
|
|
@@ -1439,7 +1482,8 @@ Create 5-15 issues.${projectName ? ` Add each to project "${projectName}".` : ""
|
|
|
1439
1482
|
process.stdout.write(`\r ${bar} ${progress}% (${i + 1}/${total}) Creating: ${issue.title.slice(0, 40)}...`.padEnd(100));
|
|
1440
1483
|
try {
|
|
1441
1484
|
const validLabels = issue.labels.filter((label) => availableLabels.size === 0 || availableLabels.has(label));
|
|
1442
|
-
const
|
|
1485
|
+
const allLabels = ["chiefwiggum", ...validLabels];
|
|
1486
|
+
const labelsArg = `--label "${allLabels.join(",")}"`;
|
|
1443
1487
|
const escapeForShell = (str) => {
|
|
1444
1488
|
return str.replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/`/g, "\\`").replace(/\$/g, "\\$").replace(/!/g, "\\!").replace(/\n/g, "\\n");
|
|
1445
1489
|
};
|
|
@@ -1452,10 +1496,23 @@ Create 5-15 issues.${projectName ? ` Add each to project "${projectName}".` : ""
|
|
|
1452
1496
|
}).trim();
|
|
1453
1497
|
if (projectNumber && issueUrl) {
|
|
1454
1498
|
try {
|
|
1455
|
-
(0, import_node_child_process6.execSync)(
|
|
1456
|
-
`gh project item-add ${projectNumber} --owner ${
|
|
1457
|
-
{ stdio: ["pipe", "pipe", "pipe"] }
|
|
1499
|
+
const addOutput = (0, import_node_child_process6.execSync)(
|
|
1500
|
+
`gh project item-add ${projectNumber} --owner ${owner} --url "${issueUrl}"`,
|
|
1501
|
+
{ encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] }
|
|
1458
1502
|
);
|
|
1503
|
+
if (projectId && statusFieldId && todoOptionId) {
|
|
1504
|
+
const itemIdMatch = addOutput.match(/Added item\s+(\S+)/i);
|
|
1505
|
+
const itemId = itemIdMatch?.[1];
|
|
1506
|
+
if (itemId) {
|
|
1507
|
+
try {
|
|
1508
|
+
(0, import_node_child_process6.execSync)(
|
|
1509
|
+
`gh project item-edit --project-id ${projectId} --id ${itemId} --field-id ${statusFieldId} --single-select-option-id ${todoOptionId}`,
|
|
1510
|
+
{ stdio: ["pipe", "pipe", "pipe"] }
|
|
1511
|
+
);
|
|
1512
|
+
} catch {
|
|
1513
|
+
}
|
|
1514
|
+
}
|
|
1515
|
+
}
|
|
1459
1516
|
} catch {
|
|
1460
1517
|
}
|
|
1461
1518
|
}
|
|
@@ -1479,7 +1536,11 @@ Create 5-15 issues.${projectName ? ` Add each to project "${projectName}".` : ""
|
|
|
1479
1536
|
}
|
|
1480
1537
|
}
|
|
1481
1538
|
if (projectName && projectNumber) {
|
|
1482
|
-
|
|
1539
|
+
if (todoOptionId) {
|
|
1540
|
+
console.log(import_picocolors7.default.green(` \u2713 Added to board "${projectName}" (Todo column)`));
|
|
1541
|
+
} else {
|
|
1542
|
+
console.log(import_picocolors7.default.green(` \u2713 Added to board "${projectName}"`));
|
|
1543
|
+
}
|
|
1483
1544
|
}
|
|
1484
1545
|
} else {
|
|
1485
1546
|
console.log(import_picocolors7.default.green(" \u2713 GitHub Issues created"));
|
|
@@ -1712,11 +1773,110 @@ init_loop();
|
|
|
1712
1773
|
// src/commands/clean.ts
|
|
1713
1774
|
init_cjs_shims();
|
|
1714
1775
|
var import_node_fs4 = require("fs");
|
|
1776
|
+
var import_node_child_process7 = require("child_process");
|
|
1715
1777
|
var import_picocolors8 = __toESM(require("picocolors"), 1);
|
|
1716
1778
|
init_prompts();
|
|
1779
|
+
init_new();
|
|
1780
|
+
async function removeIssues(numbers, action) {
|
|
1781
|
+
let success = 0;
|
|
1782
|
+
let failed = 0;
|
|
1783
|
+
for (const num of numbers) {
|
|
1784
|
+
try {
|
|
1785
|
+
if (action === "delete") {
|
|
1786
|
+
(0, import_node_child_process7.execSync)(`gh issue delete ${num} --yes`, { stdio: ["pipe", "pipe", "pipe"] });
|
|
1787
|
+
} else {
|
|
1788
|
+
(0, import_node_child_process7.execSync)(`gh issue close ${num}`, { stdio: ["pipe", "pipe", "pipe"] });
|
|
1789
|
+
}
|
|
1790
|
+
console.log(import_picocolors8.default.green(`\u2713 #${num} ${action === "delete" ? "deleted" : "closed"}`));
|
|
1791
|
+
success++;
|
|
1792
|
+
} catch {
|
|
1793
|
+
console.log(import_picocolors8.default.red(`\u2717 #${num} failed`));
|
|
1794
|
+
failed++;
|
|
1795
|
+
}
|
|
1796
|
+
}
|
|
1797
|
+
console.log();
|
|
1798
|
+
console.log(`${action === "delete" ? "Deleted" : "Closed"}: ${success}, Failed: ${failed}`);
|
|
1799
|
+
}
|
|
1800
|
+
async function cleanGitHubIssues() {
|
|
1801
|
+
let issues = [];
|
|
1802
|
+
try {
|
|
1803
|
+
const output = (0, import_node_child_process7.execSync)(
|
|
1804
|
+
`gh issue list --label chiefwiggum --state open --json number,title,createdAt --limit 100`,
|
|
1805
|
+
{ encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] }
|
|
1806
|
+
);
|
|
1807
|
+
issues = JSON.parse(output);
|
|
1808
|
+
} catch {
|
|
1809
|
+
console.log(import_picocolors8.default.yellow("Could not fetch GitHub issues."));
|
|
1810
|
+
return;
|
|
1811
|
+
}
|
|
1812
|
+
if (issues.length === 0) {
|
|
1813
|
+
console.log(import_picocolors8.default.dim("No open issues with 'chiefwiggum' label found."));
|
|
1814
|
+
return;
|
|
1815
|
+
}
|
|
1816
|
+
console.log();
|
|
1817
|
+
console.log(`Found ${issues.length} issues with 'chiefwiggum' label:`);
|
|
1818
|
+
for (const issue of issues) {
|
|
1819
|
+
console.log(` ${import_picocolors8.default.cyan(`#${issue.number}`)} - ${issue.title}`);
|
|
1820
|
+
}
|
|
1821
|
+
console.log();
|
|
1822
|
+
const action = await select2({
|
|
1823
|
+
message: "What would you like to do with these issues?",
|
|
1824
|
+
options: [
|
|
1825
|
+
{ value: "close", label: "Close all", hint: "reversible" },
|
|
1826
|
+
{ value: "delete", label: "Delete all", hint: "permanent" },
|
|
1827
|
+
{ value: "pick", label: "Pick which to remove" },
|
|
1828
|
+
{ value: "cancel", label: "Cancel" }
|
|
1829
|
+
]
|
|
1830
|
+
});
|
|
1831
|
+
if (action === "cancel") {
|
|
1832
|
+
return;
|
|
1833
|
+
}
|
|
1834
|
+
if (action === "pick") {
|
|
1835
|
+
const selected = await multiselect2({
|
|
1836
|
+
message: "Select issues to remove (space to toggle, enter to confirm)",
|
|
1837
|
+
options: issues.map((i) => ({
|
|
1838
|
+
value: String(i.number),
|
|
1839
|
+
label: `#${i.number} - ${i.title}`
|
|
1840
|
+
}))
|
|
1841
|
+
});
|
|
1842
|
+
if (selected.length === 0) {
|
|
1843
|
+
console.log(import_picocolors8.default.yellow("No issues selected."));
|
|
1844
|
+
return;
|
|
1845
|
+
}
|
|
1846
|
+
const pickAction = await select2({
|
|
1847
|
+
message: `${selected.length} issues selected. Close or delete?`,
|
|
1848
|
+
options: [
|
|
1849
|
+
{ value: "close", label: "Close", hint: "reversible" },
|
|
1850
|
+
{ value: "delete", label: "Delete", hint: "permanent" }
|
|
1851
|
+
]
|
|
1852
|
+
});
|
|
1853
|
+
await removeIssues(selected, pickAction);
|
|
1854
|
+
} else {
|
|
1855
|
+
const issueNumbers = issues.map((i) => String(i.number));
|
|
1856
|
+
const confirmMsg = action === "delete" ? `DELETE ${issues.length} issues? This cannot be undone!` : `Close ${issues.length} issues?`;
|
|
1857
|
+
const confirmed = await confirm2({
|
|
1858
|
+
message: confirmMsg,
|
|
1859
|
+
initialValue: false
|
|
1860
|
+
});
|
|
1861
|
+
if (confirmed) {
|
|
1862
|
+
await removeIssues(issueNumbers, action);
|
|
1863
|
+
}
|
|
1864
|
+
}
|
|
1865
|
+
}
|
|
1717
1866
|
async function cmdClean() {
|
|
1718
1867
|
console.log(import_picocolors8.default.bold("Clean Project"));
|
|
1719
1868
|
console.log();
|
|
1869
|
+
const tracker = getProjectTracker();
|
|
1870
|
+
if (tracker === "github") {
|
|
1871
|
+
const cleanIssues = await confirm2({
|
|
1872
|
+
message: "Clean up GitHub Issues created by Chief Wiggum?",
|
|
1873
|
+
initialValue: false
|
|
1874
|
+
});
|
|
1875
|
+
if (cleanIssues) {
|
|
1876
|
+
await cleanGitHubIssues();
|
|
1877
|
+
}
|
|
1878
|
+
console.log();
|
|
1879
|
+
}
|
|
1720
1880
|
const filesToRemove = [];
|
|
1721
1881
|
if ((0, import_node_fs4.existsSync)(".chiefwiggum")) filesToRemove.push(".chiefwiggum/");
|
|
1722
1882
|
if ((0, import_node_fs4.existsSync)("specs")) filesToRemove.push("specs/");
|
|
@@ -1750,7 +1910,7 @@ async function cmdClean() {
|
|
|
1750
1910
|
// src/commands/config.ts
|
|
1751
1911
|
init_cjs_shims();
|
|
1752
1912
|
var import_node_fs5 = require("fs");
|
|
1753
|
-
var
|
|
1913
|
+
var import_node_child_process8 = require("child_process");
|
|
1754
1914
|
var import_picocolors9 = __toESM(require("picocolors"), 1);
|
|
1755
1915
|
init_prompts();
|
|
1756
1916
|
var CONFIG_FILE2 = ".chiefwiggum/CLAUDE.md";
|
|
@@ -1783,17 +1943,17 @@ function saveConfig2(config2) {
|
|
|
1783
1943
|
}
|
|
1784
1944
|
function checkGitHubCLI2() {
|
|
1785
1945
|
try {
|
|
1786
|
-
(0,
|
|
1946
|
+
(0, import_node_child_process8.execSync)("which gh", { stdio: ["pipe", "pipe", "pipe"] });
|
|
1787
1947
|
} catch {
|
|
1788
1948
|
return { ok: false, reason: "not_installed" };
|
|
1789
1949
|
}
|
|
1790
1950
|
try {
|
|
1791
|
-
(0,
|
|
1951
|
+
(0, import_node_child_process8.execSync)("gh auth status", { stdio: ["pipe", "pipe", "pipe"] });
|
|
1792
1952
|
} catch {
|
|
1793
1953
|
return { ok: false, reason: "not_authenticated" };
|
|
1794
1954
|
}
|
|
1795
1955
|
try {
|
|
1796
|
-
const repo = (0,
|
|
1956
|
+
const repo = (0, import_node_child_process8.execSync)("gh repo view --json nameWithOwner -q .nameWithOwner", {
|
|
1797
1957
|
encoding: "utf-8",
|
|
1798
1958
|
stdio: ["pipe", "pipe", "pipe"]
|
|
1799
1959
|
}).trim();
|
|
@@ -1883,7 +2043,7 @@ async function selectOrCreateProjectBoard2(knownRepo) {
|
|
|
1883
2043
|
let repoName = knownRepo || "";
|
|
1884
2044
|
if (!repoName) {
|
|
1885
2045
|
try {
|
|
1886
|
-
repoName = (0,
|
|
2046
|
+
repoName = (0, import_node_child_process8.execSync)("gh repo view --json nameWithOwner -q .nameWithOwner", {
|
|
1887
2047
|
encoding: "utf-8",
|
|
1888
2048
|
stdio: ["pipe", "pipe", "pipe"]
|
|
1889
2049
|
}).trim();
|
|
@@ -1894,7 +2054,7 @@ async function selectOrCreateProjectBoard2(knownRepo) {
|
|
|
1894
2054
|
}
|
|
1895
2055
|
let existingProjects = [];
|
|
1896
2056
|
try {
|
|
1897
|
-
const projectsOutput = (0,
|
|
2057
|
+
const projectsOutput = (0, import_node_child_process8.execSync)(`gh project list --owner ${repoName.split("/")[0]} --format json`, {
|
|
1898
2058
|
encoding: "utf-8",
|
|
1899
2059
|
stdio: ["pipe", "pipe", "pipe"]
|
|
1900
2060
|
});
|
|
@@ -1922,7 +2082,7 @@ async function selectOrCreateProjectBoard2(knownRepo) {
|
|
|
1922
2082
|
});
|
|
1923
2083
|
console.log(import_picocolors9.default.cyan(`Creating board "${projectName}"...`));
|
|
1924
2084
|
try {
|
|
1925
|
-
const createOutput = (0,
|
|
2085
|
+
const createOutput = (0, import_node_child_process8.execSync)(
|
|
1926
2086
|
`gh project create --owner ${repoName.split("/")[0]} --title "${projectName}"`,
|
|
1927
2087
|
{ encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] }
|
|
1928
2088
|
);
|
|
@@ -1931,7 +2091,7 @@ async function selectOrCreateProjectBoard2(knownRepo) {
|
|
|
1931
2091
|
console.log(import_picocolors9.default.green(`\u2713 Board "${projectName}" created`));
|
|
1932
2092
|
if (projectNumber) {
|
|
1933
2093
|
try {
|
|
1934
|
-
(0,
|
|
2094
|
+
(0, import_node_child_process8.execSync)(`gh project link ${projectNumber} --owner ${repoName.split("/")[0]} --repo ${repoName}`, {
|
|
1935
2095
|
stdio: ["pipe", "pipe", "pipe"]
|
|
1936
2096
|
});
|
|
1937
2097
|
console.log(import_picocolors9.default.green(`\u2713 Linked to ${repoName}`));
|
|
@@ -1946,14 +2106,14 @@ async function selectOrCreateProjectBoard2(knownRepo) {
|
|
|
1946
2106
|
}
|
|
1947
2107
|
} else if (selectedProject !== "__none__") {
|
|
1948
2108
|
try {
|
|
1949
|
-
const projectsOutput = (0,
|
|
2109
|
+
const projectsOutput = (0, import_node_child_process8.execSync)(
|
|
1950
2110
|
`gh project list --owner ${repoName.split("/")[0]} --format json`,
|
|
1951
2111
|
{ encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] }
|
|
1952
2112
|
);
|
|
1953
2113
|
const projects = JSON.parse(projectsOutput);
|
|
1954
2114
|
const project = projects.projects?.find((p2) => p2.title === selectedProject);
|
|
1955
2115
|
if (project?.number) {
|
|
1956
|
-
(0,
|
|
2116
|
+
(0, import_node_child_process8.execSync)(
|
|
1957
2117
|
`gh project link ${project.number} --owner ${repoName.split("/")[0]} --repo ${repoName}`,
|
|
1958
2118
|
{ stdio: ["pipe", "pipe", "pipe"] }
|
|
1959
2119
|
);
|