chiefwiggum 1.3.17 → 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 +166 -53
  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"));
@@ -960,49 +1031,11 @@ Write directly to CLAUDE.md.`;
960
1031
  console.log(import_picocolors7.default.red("Could not detect GitHub repo. Make sure you're in a git repo with a GitHub remote."));
961
1032
  process.exit(1);
962
1033
  }
963
- let existingProjects = [];
964
- try {
965
- const projectsOutput = (0, import_node_child_process6.execSync)(`gh project list --owner ${repoName.split("/")[0]} --format json`, {
966
- encoding: "utf-8",
967
- stdio: ["pipe", "pipe", "pipe"]
968
- });
969
- const projects = JSON.parse(projectsOutput);
970
- existingProjects = projects.projects?.map((p2) => p2.title) || [];
971
- } catch {
972
- }
973
- console.log(import_picocolors7.default.bold(`GitHub Project Board`));
974
- console.log(import_picocolors7.default.dim(`Organize issues in a Kanban-style board for ${repoName}`));
975
- console.log();
976
- const projectOptions = [
977
- ...existingProjects.map((name) => ({ value: name, label: name })),
978
- { value: "__new__", label: "Create new board..." },
979
- { value: "__none__", label: "Skip (just create issues without a board)" }
980
- ];
981
- const selectedProject = await select2({
982
- message: "Add issues to a project board?",
983
- options: projectOptions
984
- });
985
- let projectName = null;
986
- if (selectedProject === "__new__") {
987
- projectName = await text2({
988
- message: "Board name",
989
- placeholder: "e.g., SVG Icon Generator v2"
990
- });
991
- console.log(import_picocolors7.default.cyan(`Creating board "${projectName}"...`));
992
- try {
993
- (0, import_node_child_process6.execSync)(`gh project create --owner ${repoName.split("/")[0]} --title "${projectName}"`, {
994
- stdio: "inherit"
995
- });
996
- console.log(import_picocolors7.default.green(`\u2713 Board "${projectName}" created`));
997
- } catch {
998
- console.log(import_picocolors7.default.yellow("Could not create board. Issues will be created without one."));
999
- projectName = null;
1000
- }
1001
- } else if (selectedProject !== "__none__") {
1002
- projectName = selectedProject;
1003
- }
1004
- console.log();
1034
+ const projectName = getGithubProject();
1005
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
+ }
1006
1039
  const projectInstruction = projectName ? `After creating each issue, add it to the project "${projectName}" using:
1007
1040
  gh project item-add <PROJECT_NUMBER> --owner ${repoName.split("/")[0]} --url <ISSUE_URL>` : "";
1008
1041
  const issuesPrompt = `You are creating GitHub Issues based on specs.
@@ -1126,9 +1159,10 @@ async function cmdClean() {
1126
1159
 
1127
1160
  // src/commands/config.ts
1128
1161
  var import_node_fs5 = require("fs");
1162
+ var import_node_child_process7 = require("child_process");
1129
1163
  var import_picocolors9 = __toESM(require("picocolors"), 1);
1130
1164
  var CONFIG_FILE2 = ".chiefwiggum/CLAUDE.md";
1131
- function getConfig() {
1165
+ function getConfig2() {
1132
1166
  if (!(0, import_node_fs5.existsSync)(CONFIG_FILE2)) {
1133
1167
  return { projectTracker: "todo" };
1134
1168
  }
@@ -1138,15 +1172,18 @@ function getConfig() {
1138
1172
  return { projectTracker: "todo" };
1139
1173
  }
1140
1174
  }
1141
- function saveConfig(config2) {
1175
+ function saveConfig2(config2) {
1142
1176
  (0, import_node_fs5.mkdirSync)(".chiefwiggum", { recursive: true });
1143
1177
  (0, import_node_fs5.writeFileSync)(CONFIG_FILE2, JSON.stringify(config2, null, 2) + "\n");
1144
1178
  }
1145
1179
  async function cmdConfig() {
1146
1180
  console.log(import_picocolors9.default.bold("Configuration"));
1147
1181
  console.log();
1148
- const config2 = getConfig();
1182
+ const config2 = getConfig2();
1149
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
+ }
1150
1187
  console.log();
1151
1188
  const newTracker = await select2({
1152
1189
  message: "Project tracker",
@@ -1156,16 +1193,92 @@ async function cmdConfig() {
1156
1193
  ],
1157
1194
  initialValue: config2.projectTracker
1158
1195
  });
1196
+ let changed = false;
1159
1197
  if (newTracker !== config2.projectTracker) {
1160
1198
  config2.projectTracker = newTracker;
1161
- 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);
1162
1216
  console.log();
1163
- 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
+ }
1164
1222
  } else {
1165
1223
  console.log();
1166
1224
  console.log(import_picocolors9.default.dim("No changes made."));
1167
1225
  }
1168
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
+ }
1169
1282
 
1170
1283
  // src/cli.ts
1171
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.17",
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": {