chiefwiggum 1.3.18 → 1.3.19

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 +136 -25
  2. package/package.json +1 -1
package/dist/cli.cjs CHANGED
@@ -794,6 +794,27 @@ async function setupTemplates() {
794
794
  console.log(import_picocolors7.default.dim(" You can customize these templates to change how specs are generated."));
795
795
  console.log();
796
796
  }
797
+ function checkGitHubCLI() {
798
+ try {
799
+ (0, import_node_child_process6.execSync)("which gh", { stdio: ["pipe", "pipe", "pipe"] });
800
+ } catch {
801
+ return { ok: false, reason: "not_installed" };
802
+ }
803
+ try {
804
+ (0, import_node_child_process6.execSync)("gh auth status", { stdio: ["pipe", "pipe", "pipe"] });
805
+ } catch {
806
+ return { ok: false, reason: "not_authenticated" };
807
+ }
808
+ try {
809
+ const repo = (0, import_node_child_process6.execSync)("gh repo view --json nameWithOwner -q .nameWithOwner", {
810
+ encoding: "utf-8",
811
+ stdio: ["pipe", "pipe", "pipe"]
812
+ }).trim();
813
+ return { ok: true, repo };
814
+ } catch {
815
+ return { ok: false, reason: "not_github_repo" };
816
+ }
817
+ }
797
818
  async function setupProjectConfig() {
798
819
  if ((0, import_node_fs3.existsSync)(CONFIG_FILE)) {
799
820
  return;
@@ -807,12 +828,48 @@ async function setupProjectConfig() {
807
828
  projectTracker: useGitHub ? "github" : "todo"
808
829
  };
809
830
  if (useGitHub) {
810
- const projectName = await selectOrCreateProjectBoard();
811
- config2.githubProject = projectName;
831
+ const ghCheck = checkGitHubCLI();
832
+ if (!ghCheck.ok) {
833
+ console.log();
834
+ if (ghCheck.reason === "not_installed") {
835
+ console.log(import_picocolors7.default.yellow("GitHub CLI (gh) is not installed."));
836
+ console.log();
837
+ console.log("To use GitHub Issues, install it first:");
838
+ console.log(import_picocolors7.default.cyan(" brew install gh # macOS"));
839
+ console.log(import_picocolors7.default.cyan(" sudo apt install gh # Ubuntu/Debian"));
840
+ console.log(import_picocolors7.default.dim(" https://cli.github.com for other platforms"));
841
+ } else if (ghCheck.reason === "not_authenticated") {
842
+ console.log(import_picocolors7.default.yellow("GitHub CLI is not authenticated."));
843
+ console.log();
844
+ console.log("Run this command to log in:");
845
+ console.log(import_picocolors7.default.cyan(" gh auth login"));
846
+ } else if (ghCheck.reason === "not_github_repo") {
847
+ console.log(import_picocolors7.default.yellow("This doesn't appear to be a GitHub repository."));
848
+ console.log();
849
+ console.log("Make sure you're in a git repo with a GitHub remote.");
850
+ }
851
+ console.log();
852
+ const fallback = await select2({
853
+ message: "What would you like to do?",
854
+ options: [
855
+ { value: "todo", label: "Use TODO.md instead", hint: "Track tasks locally" },
856
+ { value: "exit", label: "Exit and set up gh first", hint: "Then run chiefwiggum new again" }
857
+ ]
858
+ });
859
+ if (fallback === "exit") {
860
+ console.log();
861
+ console.log(import_picocolors7.default.dim("Run 'chiefwiggum new' again after setting up gh."));
862
+ process.exit(0);
863
+ }
864
+ config2.projectTracker = "todo";
865
+ } else {
866
+ const projectName = await selectOrCreateProjectBoard(ghCheck.repo);
867
+ config2.githubProject = projectName;
868
+ }
812
869
  }
813
870
  saveConfig(config2);
814
871
  console.log(import_picocolors7.default.green(`\u2713 Config saved to ${CONFIG_FILE}`));
815
- if (useGitHub) {
872
+ if (config2.projectTracker === "github") {
816
873
  console.log(import_picocolors7.default.dim(" Tasks will be created as GitHub Issues."));
817
874
  if (config2.githubProject) {
818
875
  console.log(import_picocolors7.default.dim(` Issues will be added to board: ${config2.githubProject}`));
@@ -820,16 +877,18 @@ async function setupProjectConfig() {
820
877
  }
821
878
  console.log();
822
879
  }
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;
880
+ async function selectOrCreateProjectBoard(knownRepo) {
881
+ let repoName = knownRepo || "";
882
+ if (!repoName) {
883
+ try {
884
+ repoName = (0, import_node_child_process6.execSync)("gh repo view --json nameWithOwner -q .nameWithOwner", {
885
+ encoding: "utf-8",
886
+ stdio: ["pipe", "pipe", "pipe"]
887
+ }).trim();
888
+ } catch {
889
+ console.log(import_picocolors7.default.yellow("Could not detect GitHub repo. Skipping project board setup."));
890
+ return null;
891
+ }
833
892
  }
834
893
  let existingProjects = [];
835
894
  try {
@@ -1176,6 +1235,27 @@ function saveConfig2(config2) {
1176
1235
  (0, import_node_fs5.mkdirSync)(".chiefwiggum", { recursive: true });
1177
1236
  (0, import_node_fs5.writeFileSync)(CONFIG_FILE2, JSON.stringify(config2, null, 2) + "\n");
1178
1237
  }
1238
+ function checkGitHubCLI2() {
1239
+ try {
1240
+ (0, import_node_child_process7.execSync)("which gh", { stdio: ["pipe", "pipe", "pipe"] });
1241
+ } catch {
1242
+ return { ok: false, reason: "not_installed" };
1243
+ }
1244
+ try {
1245
+ (0, import_node_child_process7.execSync)("gh auth status", { stdio: ["pipe", "pipe", "pipe"] });
1246
+ } catch {
1247
+ return { ok: false, reason: "not_authenticated" };
1248
+ }
1249
+ try {
1250
+ const repo = (0, import_node_child_process7.execSync)("gh repo view --json nameWithOwner -q .nameWithOwner", {
1251
+ encoding: "utf-8",
1252
+ stdio: ["pipe", "pipe", "pipe"]
1253
+ }).trim();
1254
+ return { ok: true, repo };
1255
+ } catch {
1256
+ return { ok: false, reason: "not_github_repo" };
1257
+ }
1258
+ }
1179
1259
  async function cmdConfig() {
1180
1260
  console.log(import_picocolors9.default.bold("Configuration"));
1181
1261
  console.log();
@@ -1194,11 +1274,40 @@ async function cmdConfig() {
1194
1274
  initialValue: config2.projectTracker
1195
1275
  });
1196
1276
  let changed = false;
1197
- if (newTracker !== config2.projectTracker) {
1277
+ if (newTracker === "github" && config2.projectTracker !== "github") {
1278
+ const ghCheck = checkGitHubCLI2();
1279
+ if (!ghCheck.ok) {
1280
+ console.log();
1281
+ if (ghCheck.reason === "not_installed") {
1282
+ console.log(import_picocolors9.default.yellow("GitHub CLI (gh) is not installed."));
1283
+ console.log();
1284
+ console.log("To use GitHub Issues, install it first:");
1285
+ console.log(import_picocolors9.default.cyan(" brew install gh # macOS"));
1286
+ console.log(import_picocolors9.default.cyan(" sudo apt install gh # Ubuntu/Debian"));
1287
+ console.log(import_picocolors9.default.dim(" https://cli.github.com for other platforms"));
1288
+ } else if (ghCheck.reason === "not_authenticated") {
1289
+ console.log(import_picocolors9.default.yellow("GitHub CLI is not authenticated."));
1290
+ console.log();
1291
+ console.log("Run this command to log in:");
1292
+ console.log(import_picocolors9.default.cyan(" gh auth login"));
1293
+ } else if (ghCheck.reason === "not_github_repo") {
1294
+ console.log(import_picocolors9.default.yellow("This doesn't appear to be a GitHub repository."));
1295
+ console.log();
1296
+ console.log("Make sure you're in a git repo with a GitHub remote.");
1297
+ }
1298
+ console.log();
1299
+ console.log(import_picocolors9.default.dim("Cannot switch to GitHub Issues. Keeping current tracker."));
1300
+ return;
1301
+ }
1302
+ config2.projectTracker = "github";
1303
+ changed = true;
1304
+ const projectName = await selectOrCreateProjectBoard2(ghCheck.repo);
1305
+ config2.githubProject = projectName;
1306
+ } else if (newTracker !== config2.projectTracker) {
1198
1307
  config2.projectTracker = newTracker;
1199
1308
  changed = true;
1200
1309
  }
1201
- if (newTracker === "github") {
1310
+ if (newTracker === "github" && config2.projectTracker === "github" && !changed) {
1202
1311
  const changeBoard = await confirm2({
1203
1312
  message: config2.githubProject ? `Change project board? (current: ${config2.githubProject})` : "Set up a project board?",
1204
1313
  initialValue: !config2.githubProject
@@ -1224,16 +1333,18 @@ async function cmdConfig() {
1224
1333
  console.log(import_picocolors9.default.dim("No changes made."));
1225
1334
  }
1226
1335
  }
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;
1336
+ async function selectOrCreateProjectBoard2(knownRepo) {
1337
+ let repoName = knownRepo || "";
1338
+ if (!repoName) {
1339
+ try {
1340
+ repoName = (0, import_node_child_process7.execSync)("gh repo view --json nameWithOwner -q .nameWithOwner", {
1341
+ encoding: "utf-8",
1342
+ stdio: ["pipe", "pipe", "pipe"]
1343
+ }).trim();
1344
+ } catch {
1345
+ console.log(import_picocolors9.default.yellow("Could not detect GitHub repo. Skipping project board setup."));
1346
+ return null;
1347
+ }
1237
1348
  }
1238
1349
  let existingProjects = [];
1239
1350
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chiefwiggum",
3
- "version": "1.3.18",
3
+ "version": "1.3.19",
4
4
  "description": "Autonomous coding agent CLI. Point it at a plan, watch it build.",
5
5
  "type": "module",
6
6
  "bin": {