chiefwiggum 1.3.15 → 1.3.18

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.
Files changed (2) hide show
  1. package/dist/cli.cjs +183 -11
  2. package/package.json +1 -1
package/dist/cli.cjs CHANGED
@@ -626,17 +626,26 @@ async function cmdLoop() {
626
626
  var __dirname = (0, import_node_path2.dirname)((0, import_node_url.fileURLToPath)(importMetaUrl));
627
627
  var LOCAL_TEMPLATES_DIR = ".chiefwiggum/templates";
628
628
  var CONFIG_FILE = ".chiefwiggum/CLAUDE.md";
629
- function getProjectTracker() {
629
+ function getConfig() {
630
630
  if (!(0, import_node_fs3.existsSync)(CONFIG_FILE)) {
631
- return "todo";
631
+ return { projectTracker: "todo" };
632
632
  }
633
633
  try {
634
- const config2 = JSON.parse((0, import_node_fs3.readFileSync)(CONFIG_FILE, "utf-8"));
635
- return config2.projectTracker || "todo";
634
+ return JSON.parse((0, import_node_fs3.readFileSync)(CONFIG_FILE, "utf-8"));
636
635
  } catch {
637
- return "todo";
636
+ return { projectTracker: "todo" };
638
637
  }
639
638
  }
639
+ function saveConfig(config2) {
640
+ (0, import_node_fs3.mkdirSync)((0, import_node_path2.dirname)(CONFIG_FILE), { recursive: true });
641
+ (0, import_node_fs3.writeFileSync)(CONFIG_FILE, JSON.stringify(config2, null, 2) + "\n");
642
+ }
643
+ function getProjectTracker() {
644
+ return getConfig().projectTracker || "todo";
645
+ }
646
+ function getGithubProject() {
647
+ return getConfig().githubProject;
648
+ }
640
649
  var BUNDLED_TEMPLATES_DIR = (0, import_node_path2.join)(__dirname, "..", "templates");
641
650
  var SKIP_DIRS = /* @__PURE__ */ new Set([
642
651
  "node_modules",
@@ -797,13 +806,75 @@ async function setupProjectConfig() {
797
806
  const config2 = {
798
807
  projectTracker: useGitHub ? "github" : "todo"
799
808
  };
800
- (0, import_node_fs3.writeFileSync)(CONFIG_FILE, JSON.stringify(config2, null, 2) + "\n");
809
+ if (useGitHub) {
810
+ const projectName = await selectOrCreateProjectBoard();
811
+ config2.githubProject = projectName;
812
+ }
813
+ saveConfig(config2);
801
814
  console.log(import_picocolors7.default.green(`\u2713 Config saved to ${CONFIG_FILE}`));
802
815
  if (useGitHub) {
803
816
  console.log(import_picocolors7.default.dim(" Tasks will be created as GitHub Issues."));
817
+ if (config2.githubProject) {
818
+ console.log(import_picocolors7.default.dim(` Issues will be added to board: ${config2.githubProject}`));
819
+ }
804
820
  }
805
821
  console.log();
806
822
  }
823
+ async function selectOrCreateProjectBoard() {
824
+ let repoName = "";
825
+ try {
826
+ repoName = (0, import_node_child_process6.execSync)("gh repo view --json nameWithOwner -q .nameWithOwner", {
827
+ encoding: "utf-8",
828
+ stdio: ["pipe", "pipe", "pipe"]
829
+ }).trim();
830
+ } catch {
831
+ console.log(import_picocolors7.default.yellow("Could not detect GitHub repo. Skipping project board setup."));
832
+ return null;
833
+ }
834
+ let existingProjects = [];
835
+ try {
836
+ const projectsOutput = (0, import_node_child_process6.execSync)(`gh project list --owner ${repoName.split("/")[0]} --format json`, {
837
+ encoding: "utf-8",
838
+ stdio: ["pipe", "pipe", "pipe"]
839
+ });
840
+ const projects = JSON.parse(projectsOutput);
841
+ existingProjects = projects.projects?.map((p2) => p2.title) || [];
842
+ } catch {
843
+ }
844
+ console.log();
845
+ console.log(import_picocolors7.default.bold(`GitHub Project Board`));
846
+ console.log(import_picocolors7.default.dim(`Organize issues in a Kanban-style board for ${repoName}`));
847
+ console.log();
848
+ const projectOptions = [
849
+ ...existingProjects.map((name) => ({ value: name, label: name })),
850
+ { value: "__new__", label: "Create new board..." },
851
+ { value: "__none__", label: "Skip (just create issues without a board)" }
852
+ ];
853
+ const selectedProject = await select2({
854
+ message: "Add issues to a project board?",
855
+ options: projectOptions
856
+ });
857
+ if (selectedProject === "__new__") {
858
+ const projectName = await text2({
859
+ message: "Board name",
860
+ placeholder: "e.g., SVG Icon Generator v2"
861
+ });
862
+ console.log(import_picocolors7.default.cyan(`Creating board "${projectName}"...`));
863
+ try {
864
+ (0, import_node_child_process6.execSync)(`gh project create --owner ${repoName.split("/")[0]} --title "${projectName}"`, {
865
+ stdio: "inherit"
866
+ });
867
+ console.log(import_picocolors7.default.green(`\u2713 Board "${projectName}" created`));
868
+ return projectName;
869
+ } catch {
870
+ console.log(import_picocolors7.default.yellow("Could not create board. Issues will be created without one."));
871
+ return null;
872
+ }
873
+ } else if (selectedProject !== "__none__") {
874
+ return selectedProject;
875
+ }
876
+ return null;
877
+ }
807
878
  async function interactiveDescribe() {
808
879
  console.log();
809
880
  console.log(import_picocolors7.default.bold("Tell me about your project"));
@@ -950,7 +1021,23 @@ Write directly to CLAUDE.md.`;
950
1021
  const techGenerated = (0, import_node_fs3.existsSync)(techPath) ? (0, import_node_fs3.readFileSync)(techPath, "utf-8") : "";
951
1022
  if (tracker === "github") {
952
1023
  console.log();
1024
+ let repoName = "";
1025
+ try {
1026
+ repoName = (0, import_node_child_process6.execSync)("gh repo view --json nameWithOwner -q .nameWithOwner", {
1027
+ encoding: "utf-8",
1028
+ stdio: ["pipe", "pipe", "pipe"]
1029
+ }).trim();
1030
+ } catch {
1031
+ console.log(import_picocolors7.default.red("Could not detect GitHub repo. Make sure you're in a git repo with a GitHub remote."));
1032
+ process.exit(1);
1033
+ }
1034
+ const projectName = getGithubProject();
953
1035
  console.log(import_picocolors7.default.yellow("[4/4] Creating GitHub Issues..."));
1036
+ if (projectName) {
1037
+ console.log(import_picocolors7.default.dim(` Issues will be added to board: ${projectName}`));
1038
+ }
1039
+ const projectInstruction = projectName ? `After creating each issue, add it to the project "${projectName}" using:
1040
+ gh project item-add <PROJECT_NUMBER> --owner ${repoName.split("/")[0]} --url <ISSUE_URL>` : "";
954
1041
  const issuesPrompt = `You are creating GitHub Issues based on specs.
955
1042
 
956
1043
  Here is the PRD:
@@ -970,10 +1057,15 @@ Group related issues with labels like "phase-1", "phase-2", etc.
970
1057
  For each issue, run a command like:
971
1058
  gh issue create --title "Issue title" --body "Description of the task" --label "phase-1"
972
1059
 
1060
+ ${projectInstruction}
1061
+
973
1062
  Create 5-15 issues covering the full implementation.
974
1063
  Do NOT create a TODO.md file - only create GitHub Issues.`;
975
1064
  await runClaude({ prompt: issuesPrompt });
976
1065
  console.log(import_picocolors7.default.green(" \u2713 GitHub Issues created"));
1066
+ if (projectName) {
1067
+ console.log(import_picocolors7.default.green(` \u2713 Added to board "${projectName}"`));
1068
+ }
977
1069
  } else {
978
1070
  console.log();
979
1071
  console.log(import_picocolors7.default.yellow(`[4/4] Generating ${todoFile}...`));
@@ -1067,9 +1159,10 @@ async function cmdClean() {
1067
1159
 
1068
1160
  // src/commands/config.ts
1069
1161
  var import_node_fs5 = require("fs");
1162
+ var import_node_child_process7 = require("child_process");
1070
1163
  var import_picocolors9 = __toESM(require("picocolors"), 1);
1071
1164
  var CONFIG_FILE2 = ".chiefwiggum/CLAUDE.md";
1072
- function getConfig() {
1165
+ function getConfig2() {
1073
1166
  if (!(0, import_node_fs5.existsSync)(CONFIG_FILE2)) {
1074
1167
  return { projectTracker: "todo" };
1075
1168
  }
@@ -1079,15 +1172,18 @@ function getConfig() {
1079
1172
  return { projectTracker: "todo" };
1080
1173
  }
1081
1174
  }
1082
- function saveConfig(config2) {
1175
+ function saveConfig2(config2) {
1083
1176
  (0, import_node_fs5.mkdirSync)(".chiefwiggum", { recursive: true });
1084
1177
  (0, import_node_fs5.writeFileSync)(CONFIG_FILE2, JSON.stringify(config2, null, 2) + "\n");
1085
1178
  }
1086
1179
  async function cmdConfig() {
1087
1180
  console.log(import_picocolors9.default.bold("Configuration"));
1088
1181
  console.log();
1089
- const config2 = getConfig();
1182
+ const config2 = getConfig2();
1090
1183
  console.log(`Current tracker: ${import_picocolors9.default.cyan(config2.projectTracker)}`);
1184
+ if (config2.projectTracker === "github") {
1185
+ console.log(`GitHub Project Board: ${import_picocolors9.default.cyan(config2.githubProject || "(none)")}`);
1186
+ }
1091
1187
  console.log();
1092
1188
  const newTracker = await select2({
1093
1189
  message: "Project tracker",
@@ -1097,16 +1193,92 @@ async function cmdConfig() {
1097
1193
  ],
1098
1194
  initialValue: config2.projectTracker
1099
1195
  });
1196
+ let changed = false;
1100
1197
  if (newTracker !== config2.projectTracker) {
1101
1198
  config2.projectTracker = newTracker;
1102
- saveConfig(config2);
1199
+ changed = true;
1200
+ }
1201
+ if (newTracker === "github") {
1202
+ const changeBoard = await confirm2({
1203
+ message: config2.githubProject ? `Change project board? (current: ${config2.githubProject})` : "Set up a project board?",
1204
+ initialValue: !config2.githubProject
1205
+ });
1206
+ if (changeBoard) {
1207
+ const projectName = await selectOrCreateProjectBoard2();
1208
+ if (projectName !== config2.githubProject) {
1209
+ config2.githubProject = projectName;
1210
+ changed = true;
1211
+ }
1212
+ }
1213
+ }
1214
+ if (changed) {
1215
+ saveConfig2(config2);
1103
1216
  console.log();
1104
- console.log(import_picocolors9.default.green(`\u2713 Tracker changed to ${newTracker}`));
1217
+ console.log(import_picocolors9.default.green(`\u2713 Config updated`));
1218
+ console.log(import_picocolors9.default.dim(` Tracker: ${config2.projectTracker}`));
1219
+ if (config2.projectTracker === "github" && config2.githubProject) {
1220
+ console.log(import_picocolors9.default.dim(` Project board: ${config2.githubProject}`));
1221
+ }
1105
1222
  } else {
1106
1223
  console.log();
1107
1224
  console.log(import_picocolors9.default.dim("No changes made."));
1108
1225
  }
1109
1226
  }
1227
+ async function selectOrCreateProjectBoard2() {
1228
+ let repoName = "";
1229
+ try {
1230
+ repoName = (0, import_node_child_process7.execSync)("gh repo view --json nameWithOwner -q .nameWithOwner", {
1231
+ encoding: "utf-8",
1232
+ stdio: ["pipe", "pipe", "pipe"]
1233
+ }).trim();
1234
+ } catch {
1235
+ console.log(import_picocolors9.default.yellow("Could not detect GitHub repo. Skipping project board setup."));
1236
+ return null;
1237
+ }
1238
+ let existingProjects = [];
1239
+ try {
1240
+ const projectsOutput = (0, import_node_child_process7.execSync)(`gh project list --owner ${repoName.split("/")[0]} --format json`, {
1241
+ encoding: "utf-8",
1242
+ stdio: ["pipe", "pipe", "pipe"]
1243
+ });
1244
+ const projects = JSON.parse(projectsOutput);
1245
+ existingProjects = projects.projects?.map((p2) => p2.title) || [];
1246
+ } catch {
1247
+ }
1248
+ console.log();
1249
+ console.log(import_picocolors9.default.bold(`GitHub Project Board`));
1250
+ console.log(import_picocolors9.default.dim(`Organize issues in a Kanban-style board for ${repoName}`));
1251
+ console.log();
1252
+ const projectOptions = [
1253
+ ...existingProjects.map((name) => ({ value: name, label: name })),
1254
+ { value: "__new__", label: "Create new board..." },
1255
+ { value: "__none__", label: "No board (just create issues)" }
1256
+ ];
1257
+ const selectedProject = await select2({
1258
+ message: "Select a project board",
1259
+ options: projectOptions
1260
+ });
1261
+ if (selectedProject === "__new__") {
1262
+ const projectName = await text2({
1263
+ message: "Board name",
1264
+ placeholder: "e.g., SVG Icon Generator v2"
1265
+ });
1266
+ console.log(import_picocolors9.default.cyan(`Creating board "${projectName}"...`));
1267
+ try {
1268
+ (0, import_node_child_process7.execSync)(`gh project create --owner ${repoName.split("/")[0]} --title "${projectName}"`, {
1269
+ stdio: "inherit"
1270
+ });
1271
+ console.log(import_picocolors9.default.green(`\u2713 Board "${projectName}" created`));
1272
+ return projectName;
1273
+ } catch {
1274
+ console.log(import_picocolors9.default.yellow("Could not create board."));
1275
+ return null;
1276
+ }
1277
+ } else if (selectedProject !== "__none__") {
1278
+ return selectedProject;
1279
+ }
1280
+ return null;
1281
+ }
1110
1282
 
1111
1283
  // src/cli.ts
1112
1284
  var __dirname2 = (0, import_node_path3.dirname)((0, import_node_url2.fileURLToPath)(importMetaUrl));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chiefwiggum",
3
- "version": "1.3.15",
3
+ "version": "1.3.18",
4
4
  "description": "Autonomous coding agent CLI. Point it at a plan, watch it build.",
5
5
  "type": "module",
6
6
  "bin": {