ya-git-jira 2.0.0 → 2.1.1

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 (94) hide show
  1. package/.dockerignore +8 -0
  2. package/.opencode/skills/git-confluence/SKILL.md +18 -18
  3. package/.opencode/skills/git-jira/SKILL.md +18 -18
  4. package/.opencode/skills/git-lab/SKILL.md +30 -30
  5. package/Dockerfile +58 -0
  6. package/README.md +31 -12
  7. package/bin/git-api.ts +2 -4
  8. package/bin/git-bump.ts +2 -4
  9. package/bin/git-confluence-page-search.ts +4 -6
  10. package/bin/git-confluence-page-show.ts +3 -5
  11. package/bin/git-confluence-page-update.ts +3 -5
  12. package/bin/git-confluence-page.ts +2 -4
  13. package/bin/git-confluence-space-list.ts +3 -5
  14. package/bin/git-confluence-space.ts +2 -4
  15. package/bin/git-confluence-whoami.ts +3 -5
  16. package/bin/git-confluence.ts +11 -4
  17. package/bin/git-jira-issue-list.ts +2 -4
  18. package/bin/git-jira-issue-show.ts +3 -5
  19. package/bin/git-jira-issue.ts +2 -4
  20. package/bin/git-jira-start.ts +2 -4
  21. package/bin/git-jira-whoami.ts +3 -5
  22. package/bin/git-jira.ts +11 -4
  23. package/bin/git-lab-group-list.ts +4 -6
  24. package/bin/git-lab-group.ts +2 -4
  25. package/bin/git-lab-merge-active.ts +4 -6
  26. package/bin/git-lab-merge-todo.ts +4 -6
  27. package/bin/git-lab-merge-train-list.ts +3 -5
  28. package/bin/git-lab-merge-train.ts +2 -4
  29. package/bin/git-lab-merge.ts +2 -4
  30. package/bin/git-lab-namespace-list.ts +3 -5
  31. package/bin/git-lab-namespace.ts +2 -4
  32. package/bin/git-lab-project-list.ts +4 -6
  33. package/bin/git-lab-project-mr-list.ts +4 -6
  34. package/bin/git-lab-project-mr.ts +2 -4
  35. package/bin/git-lab-project-pipeline-jobs.ts +2 -4
  36. package/bin/git-lab-project-pipeline-latest.ts +2 -4
  37. package/bin/git-lab-project-pipeline-list.ts +4 -6
  38. package/bin/git-lab-project-pipeline-log.ts +2 -4
  39. package/bin/git-lab-project-pipeline.ts +2 -4
  40. package/bin/git-lab-project-whereami.ts +3 -5
  41. package/bin/git-lab-project.ts +2 -4
  42. package/bin/git-lab-whoami.ts +3 -5
  43. package/bin/git-lab.ts +11 -4
  44. package/bin/gitj-install-skills.ts +15 -12
  45. package/bin/gitj.ts +6 -1
  46. package/dist/bin/git-api.js +33 -5
  47. package/dist/bin/git-bump.js +32 -24
  48. package/dist/bin/git-confluence-page-search.js +46 -26
  49. package/dist/bin/git-confluence-page-show.js +24 -4
  50. package/dist/bin/git-confluence-page-update.js +24 -4
  51. package/dist/bin/git-confluence-page.js +30 -16
  52. package/dist/bin/git-confluence-space-list.js +45 -25
  53. package/dist/bin/git-confluence-space.js +46 -28
  54. package/dist/bin/git-confluence-whoami.js +45 -25
  55. package/dist/bin/git-confluence.js +45 -31
  56. package/dist/bin/git-jira-issue-list.js +36 -24
  57. package/dist/bin/git-jira-issue-show.js +16 -4
  58. package/dist/bin/git-jira-issue.js +18 -10
  59. package/dist/bin/git-jira-start.js +16 -4
  60. package/dist/bin/git-jira-whoami.js +37 -25
  61. package/dist/bin/git-jira.js +32 -22
  62. package/dist/bin/git-lab-group-list.js +18 -6
  63. package/dist/bin/git-lab-group.js +19 -9
  64. package/dist/bin/git-lab-merge-active.js +18 -6
  65. package/dist/bin/git-lab-merge-todo.js +18 -6
  66. package/dist/bin/git-lab-merge-train-list.js +17 -5
  67. package/dist/bin/git-lab-merge-train.js +18 -8
  68. package/dist/bin/git-lab-merge.js +25 -21
  69. package/dist/bin/git-lab-namespace-list.js +38 -26
  70. package/dist/bin/git-lab-namespace.js +39 -29
  71. package/dist/bin/git-lab-project-list.js +18 -6
  72. package/dist/bin/git-lab-project-mr-list.js +18 -6
  73. package/dist/bin/git-lab-project-mr.js +19 -9
  74. package/dist/bin/git-lab-project-pipeline-jobs.js +16 -4
  75. package/dist/bin/git-lab-project-pipeline-latest.js +16 -4
  76. package/dist/bin/git-lab-project-pipeline-list.js +18 -6
  77. package/dist/bin/git-lab-project-pipeline-log.js +16 -4
  78. package/dist/bin/git-lab-project-pipeline.js +22 -18
  79. package/dist/bin/git-lab-project-whereami.js +17 -5
  80. package/dist/bin/git-lab-project.js +32 -38
  81. package/dist/bin/git-lab-whoami.js +17 -5
  82. package/dist/bin/git-lab.js +61 -81
  83. package/dist/bin/gitj-install-skills.js +21 -11
  84. package/dist/bin/gitj.js +154 -153
  85. package/dist/index.js +32 -1
  86. package/install-docker-gitj.sh +77 -0
  87. package/lib/api.ts +19 -1
  88. package/lib/confluence/api.ts +12 -0
  89. package/lib/confluence/config.ts +3 -3
  90. package/lib/gitlab/api.ts +4 -0
  91. package/lib/gitlab/config.ts +2 -2
  92. package/lib/is_main.ts +11 -0
  93. package/lib/jira.ts +7 -3
  94. package/package.json +1 -1
package/dist/bin/gitj.js CHANGED
@@ -2497,7 +2497,7 @@ async function getGitlabConfig() {
2497
2497
  const host = await hostP || "gitlab.com";
2498
2498
  const user = await gitEmailP || await gitlabEmailP;
2499
2499
  if (!user)
2500
- throw new Error("Neither user.email nor gitlab.email in git config");
2500
+ throw new Error("Neither user.email nor gitlab.user in git config");
2501
2501
  const token = await tokenP;
2502
2502
  if (!token)
2503
2503
  throw new Error("gitlab.token not in git config");
@@ -2534,6 +2534,10 @@ async function gitlabApi(endpoint) {
2534
2534
  };
2535
2535
  let request = new Request(uri, options);
2536
2536
  const response = await fetch(request);
2537
+ if (!response.ok) {
2538
+ const text = await response.text();
2539
+ throw new Error(`GitLab API ${endpoint} failed (${response.status}): ${text}`);
2540
+ }
2537
2541
  let link = getNextLink(response.headers.get("Link"));
2538
2542
  let partial = await response.json();
2539
2543
  let result = partial;
@@ -2696,6 +2700,16 @@ function isMain(self) {
2696
2700
  const result = argv1Base === selfBase;
2697
2701
  return result;
2698
2702
  }
2703
+ async function runMain(self, create) {
2704
+ if (!isMain(self))
2705
+ return;
2706
+ try {
2707
+ await create().parseAsync(Bun.argv);
2708
+ } catch (err) {
2709
+ console.error(`error: ${err instanceof Error ? err.message : String(err)}`);
2710
+ process.exit(1);
2711
+ }
2712
+ }
2699
2713
 
2700
2714
  // bin/git-lab-merge-active.ts
2701
2715
  var version = await getPackageVersion();
@@ -2708,22 +2722,20 @@ function create() {
2708
2722
  process.exit(1);
2709
2723
  }
2710
2724
  if (options.verbose) {
2711
- console.log(merges);
2725
+ console.log(JSON.stringify(merges, null, 2));
2712
2726
  process.exit(0);
2713
2727
  } else {
2714
2728
  const filtered = merges.map((m) => {
2715
2729
  const { title, web_url, source_branch, target_branch } = m;
2716
2730
  return { title, web_url, source_branch, target_branch };
2717
2731
  });
2718
- console.log(filtered);
2732
+ console.log(JSON.stringify(filtered, null, 2));
2719
2733
  }
2720
2734
  });
2721
2735
  return program2;
2722
2736
  }
2723
2737
  var git_lab_merge_active_default = create;
2724
- if (isMain("git-lab-merge-active")) {
2725
- await create().parseAsync(Bun.argv);
2726
- }
2738
+ await runMain("git-lab-merge-active", create);
2727
2739
 
2728
2740
  // bin/git-lab-merge-todo.ts
2729
2741
  var version2 = await getPackageVersion();
@@ -2732,21 +2744,19 @@ function create2() {
2732
2744
  program2.version(version2).name("todo").description("MRs needing my review").option("-v, --verbose", "Verbose output").action(async (options) => {
2733
2745
  const mrs = await getMyMergeRequestsToReview();
2734
2746
  if (options.verbose) {
2735
- console.log(mrs);
2747
+ console.log(JSON.stringify(mrs, null, 2));
2736
2748
  } else {
2737
2749
  const filtered = mrs.map((mr) => {
2738
2750
  const { title, web_url, source_branch, target_branch } = mr;
2739
2751
  return { title, web_url, source_branch, target_branch };
2740
2752
  });
2741
- console.log(filtered);
2753
+ console.log(JSON.stringify(filtered, null, 2));
2742
2754
  }
2743
2755
  });
2744
2756
  return program2;
2745
2757
  }
2746
2758
  var git_lab_merge_todo_default = create2;
2747
- if (isMain("git-lab-merge-todo")) {
2748
- await create2().parseAsync(Bun.argv);
2749
- }
2759
+ await runMain("git-lab-merge-todo", create2);
2750
2760
 
2751
2761
  // lib/gitlab/merge-trains.ts
2752
2762
  async function getMergeTrains() {
@@ -2759,14 +2769,12 @@ function create3() {
2759
2769
  const program2 = new Command;
2760
2770
  program2.version(version3).name("list").description("List merge trains for the current project").action(async () => {
2761
2771
  const trains = await getMergeTrains();
2762
- console.log(trains);
2772
+ console.log(JSON.stringify(trains, null, 2));
2763
2773
  });
2764
2774
  return program2;
2765
2775
  }
2766
2776
  var git_lab_merge_train_list_default = create3;
2767
- if (isMain("git-lab-merge-train-list")) {
2768
- await create3().parseAsync(Bun.argv);
2769
- }
2777
+ await runMain("git-lab-merge-train-list", create3);
2770
2778
 
2771
2779
  // bin/git-lab-merge-train.ts
2772
2780
  var version4 = await getPackageVersion();
@@ -2776,9 +2784,7 @@ function create4() {
2776
2784
  return program2;
2777
2785
  }
2778
2786
  var git_lab_merge_train_default = create4;
2779
- if (isMain("git-lab-merge-train")) {
2780
- await create4().parseAsync(Bun.argv);
2781
- }
2787
+ await runMain("git-lab-merge-train", create4);
2782
2788
 
2783
2789
  // bin/git-lab-merge.ts
2784
2790
  var version5 = await getPackageVersion();
@@ -2788,9 +2794,7 @@ function create5() {
2788
2794
  return program2;
2789
2795
  }
2790
2796
  var git_lab_merge_default = create5;
2791
- if (isMain("git-lab-merge")) {
2792
- await create5().parseAsync(Bun.argv);
2793
- }
2797
+ await runMain("git-lab-merge", create5);
2794
2798
 
2795
2799
  // bin/git-lab-namespace-list.ts
2796
2800
  var version6 = await getPackageVersion();
@@ -2798,14 +2802,12 @@ function create6() {
2798
2802
  const program2 = new Command;
2799
2803
  program2.version(version6).name("list").description("List namespaces for the current user").action(async () => {
2800
2804
  const namespaces = await getNamespaces();
2801
- console.log(namespaces);
2805
+ console.log(JSON.stringify(namespaces, null, 2));
2802
2806
  });
2803
2807
  return program2;
2804
2808
  }
2805
2809
  var git_lab_namespace_list_default = create6;
2806
- if (isMain("git-lab-namespace-list")) {
2807
- await create6().parseAsync(Bun.argv);
2808
- }
2810
+ await runMain("git-lab-namespace-list", create6);
2809
2811
 
2810
2812
  // bin/git-lab-namespace.ts
2811
2813
  var version7 = await getPackageVersion();
@@ -2815,9 +2817,7 @@ function create7() {
2815
2817
  return program2;
2816
2818
  }
2817
2819
  var git_lab_namespace_default = create7;
2818
- if (isMain("git-lab-namespace")) {
2819
- await create7().parseAsync(Bun.argv);
2820
- }
2820
+ await runMain("git-lab-namespace", create7);
2821
2821
 
2822
2822
  // bin/git-lab-project-list.ts
2823
2823
  var version8 = await getPackageVersion();
@@ -2830,21 +2830,19 @@ function create8() {
2830
2830
  process.exit(1);
2831
2831
  }
2832
2832
  if (options.verbose) {
2833
- console.log(projects);
2833
+ console.log(JSON.stringify(projects, null, 2));
2834
2834
  } else {
2835
2835
  let filtered = projects.map((p) => {
2836
2836
  const { id, name, path_with_namespace, ssh_url_to_repo } = p;
2837
2837
  return { id, name, path_with_namespace, ssh_url_to_repo };
2838
2838
  });
2839
- console.log(filtered);
2839
+ console.log(JSON.stringify(filtered, null, 2));
2840
2840
  }
2841
2841
  });
2842
2842
  return program2;
2843
2843
  }
2844
2844
  var git_lab_project_list_default = create8;
2845
- if (isMain("git-lab-project-list")) {
2846
- await create8().parseAsync(Bun.argv);
2847
- }
2845
+ await runMain("git-lab-project-list", create8);
2848
2846
 
2849
2847
  // bin/git-lab-project-mr-list.ts
2850
2848
  var version9 = await getPackageVersion();
@@ -2868,21 +2866,19 @@ function create9() {
2868
2866
  process.exit(0);
2869
2867
  }
2870
2868
  if (options.verbose) {
2871
- console.log(mrs);
2869
+ console.log(JSON.stringify(mrs, null, 2));
2872
2870
  } else {
2873
2871
  const filtered = mrs.map((m) => {
2874
2872
  const { iid, title, web_url, source_branch, target_branch, state, draft } = m;
2875
2873
  return { iid, title, web_url, source_branch, target_branch, state, draft };
2876
2874
  });
2877
- console.log(filtered);
2875
+ console.log(JSON.stringify(filtered, null, 2));
2878
2876
  }
2879
2877
  });
2880
2878
  return program2;
2881
2879
  }
2882
2880
  var git_lab_project_mr_list_default = create9;
2883
- if (isMain("git-lab-project-mr-list")) {
2884
- await create9().parseAsync(Bun.argv);
2885
- }
2881
+ await runMain("git-lab-project-mr-list", create9);
2886
2882
 
2887
2883
  // bin/git-lab-project-mr.ts
2888
2884
  var version10 = await getPackageVersion();
@@ -2892,9 +2888,7 @@ function create10() {
2892
2888
  return program2;
2893
2889
  }
2894
2890
  var git_lab_project_mr_default = create10;
2895
- if (isMain("git-lab-project-mr")) {
2896
- await create10().parseAsync(Bun.argv);
2897
- }
2891
+ await runMain("git-lab-project-mr", create10);
2898
2892
 
2899
2893
  // bin/git-lab-project-pipeline-jobs.ts
2900
2894
  var version11 = await getPackageVersion();
@@ -2924,9 +2918,7 @@ function create11() {
2924
2918
  return program2;
2925
2919
  }
2926
2920
  var git_lab_project_pipeline_jobs_default = create11;
2927
- if (isMain("git-lab-project-pipeline-jobs")) {
2928
- await create11().parseAsync(Bun.argv);
2929
- }
2921
+ await runMain("git-lab-project-pipeline-jobs", create11);
2930
2922
 
2931
2923
  // bin/git-lab-project-pipeline-latest.ts
2932
2924
  var version12 = await getPackageVersion();
@@ -2958,9 +2950,7 @@ function create12() {
2958
2950
  return program2;
2959
2951
  }
2960
2952
  var git_lab_project_pipeline_latest_default = create12;
2961
- if (isMain("git-lab-project-pipeline-latest")) {
2962
- await create12().parseAsync(Bun.argv);
2963
- }
2953
+ await runMain("git-lab-project-pipeline-latest", create12);
2964
2954
 
2965
2955
  // bin/git-lab-project-pipeline-list.ts
2966
2956
  var import_debug2 = __toESM(require_src(), 1);
@@ -2976,21 +2966,19 @@ function create13() {
2976
2966
  process.exit(1);
2977
2967
  }
2978
2968
  if (options.verbose) {
2979
- console.log(pipelines);
2969
+ console.log(JSON.stringify(pipelines, null, 2));
2980
2970
  } else {
2981
2971
  let filtered = pipelines.map((p) => {
2982
2972
  const { id, web_url, updated_at, ref, sha } = p;
2983
2973
  return { id, web_url, updated_at, ref, sha };
2984
2974
  });
2985
- console.log(filtered);
2975
+ console.log(JSON.stringify(filtered, null, 2));
2986
2976
  }
2987
2977
  });
2988
2978
  return program2;
2989
2979
  }
2990
2980
  var git_lab_project_pipeline_list_default = create13;
2991
- if (isMain("git-lab-project-pipeline-list")) {
2992
- await create13().parseAsync(Bun.argv);
2993
- }
2981
+ await runMain("git-lab-project-pipeline-list", create13);
2994
2982
 
2995
2983
  // bin/git-lab-project-pipeline-log.ts
2996
2984
  var version14 = await getPackageVersion();
@@ -3025,9 +3013,7 @@ function create14() {
3025
3013
  return program2;
3026
3014
  }
3027
3015
  var git_lab_project_pipeline_log_default = create14;
3028
- if (isMain("git-lab-project-pipeline-log")) {
3029
- await create14().parseAsync(Bun.argv);
3030
- }
3016
+ await runMain("git-lab-project-pipeline-log", create14);
3031
3017
 
3032
3018
  // bin/git-lab-project-pipeline.ts
3033
3019
  var version15 = await getPackageVersion();
@@ -3037,9 +3023,7 @@ function create15() {
3037
3023
  return program2;
3038
3024
  }
3039
3025
  var git_lab_project_pipeline_default = create15;
3040
- if (isMain("git-lab-project-pipeline")) {
3041
- await create15().parseAsync(Bun.argv);
3042
- }
3026
+ await runMain("git-lab-project-pipeline", create15);
3043
3027
 
3044
3028
  // bin/git-lab-project-whereami.ts
3045
3029
  var version16 = await getPackageVersion();
@@ -3058,7 +3042,7 @@ function create16() {
3058
3042
  process.exit(1);
3059
3043
  }
3060
3044
  if (options.verbose) {
3061
- console.log(project2);
3045
+ console.log(JSON.stringify(project2, null, 2));
3062
3046
  } else {
3063
3047
  const { id, name, path_with_namespace, ssh_url_to_repo } = project2;
3064
3048
  console.log({ id, name, path_with_namespace, ssh_url_to_repo });
@@ -3067,9 +3051,7 @@ function create16() {
3067
3051
  return program2;
3068
3052
  }
3069
3053
  var git_lab_project_whereami_default = create16;
3070
- if (isMain("git-lab-project-whereami")) {
3071
- await create16().parseAsync(Bun.argv);
3072
- }
3054
+ await runMain("git-lab-project-whereami", create16);
3073
3055
 
3074
3056
  // bin/git-lab-project.ts
3075
3057
  var version17 = await getPackageVersion();
@@ -3081,9 +3063,7 @@ function create17() {
3081
3063
  return program2;
3082
3064
  }
3083
3065
  var git_lab_project_default = create17;
3084
- if (isMain("git-lab-project")) {
3085
- await create17().parseAsync(Bun.argv);
3086
- }
3066
+ await runMain("git-lab-project", create17);
3087
3067
 
3088
3068
  // lib/confluence/config.ts
3089
3069
  var gitEmailP2 = getConfig("user.email");
@@ -3136,6 +3116,10 @@ async function confluenceApi(endpoint) {
3136
3116
  };
3137
3117
  let request = new Request(uri, options);
3138
3118
  const response = await fetch(request);
3119
+ if (!response.ok) {
3120
+ const text = await response.text();
3121
+ throw new Error(`Confluence API ${endpoint} failed (${response.status}): ${text}`);
3122
+ }
3139
3123
  let link = getNextLink2(response.headers.get("Link"));
3140
3124
  const body = await response.json();
3141
3125
  if (!body.results) {
@@ -3196,6 +3180,10 @@ async function confluenceSearch(cql) {
3196
3180
  while (uri) {
3197
3181
  const request = new Request(uri, options);
3198
3182
  const response = await fetch(request);
3183
+ if (!response.ok) {
3184
+ const text = await response.text();
3185
+ throw new Error(`Confluence search failed (${response.status}): ${text}`);
3186
+ }
3199
3187
  const body = await response.json();
3200
3188
  if (body.results) {
3201
3189
  allResults = allResults.concat(body.results);
@@ -3224,6 +3212,10 @@ async function confluenceApiV1(endpoint) {
3224
3212
  };
3225
3213
  const request = new Request(uri, options);
3226
3214
  const response = await fetch(request);
3215
+ if (!response.ok) {
3216
+ const text = await response.text();
3217
+ throw new Error(`Confluence API v1 ${endpoint} failed (${response.status}): ${text}`);
3218
+ }
3227
3219
  const result = await response.json();
3228
3220
  return result;
3229
3221
  }
@@ -3234,7 +3226,7 @@ function create18() {
3234
3226
  program2.version(version18).name("list").description("List Confluence spaces").option("-v, --verbose", "Verbose output").action(async (options) => {
3235
3227
  const spaces = await confluenceApi("spaces");
3236
3228
  if (options.verbose) {
3237
- console.log(spaces);
3229
+ console.log(JSON.stringify(spaces, null, 2));
3238
3230
  } else {
3239
3231
  for (const space of spaces) {
3240
3232
  console.log(`${space.key} ${space.name}`);
@@ -3244,9 +3236,7 @@ function create18() {
3244
3236
  return program2;
3245
3237
  }
3246
3238
  var git_confluence_space_list_default = create18;
3247
- if (isMain("git-confluence-space-list")) {
3248
- await create18().parseAsync(Bun.argv);
3249
- }
3239
+ await runMain("git-confluence-space-list", create18);
3250
3240
 
3251
3241
  // bin/git-confluence-page-search.ts
3252
3242
  var version19 = await getPackageVersion();
@@ -3257,7 +3247,7 @@ function create19() {
3257
3247
  if (options.exact) {
3258
3248
  const pages = await confluenceApi(`pages?title=${encodeURIComponent(query)}`);
3259
3249
  if (options.verbose) {
3260
- console.log(pages);
3250
+ console.log(JSON.stringify(pages, null, 2));
3261
3251
  } else {
3262
3252
  for (const page of pages) {
3263
3253
  const url = `https://${host}/wiki/spaces/${page.spaceId}/pages/${page.id}`;
@@ -3270,7 +3260,7 @@ function create19() {
3270
3260
  const cql = `type=page AND ${field} ~ "${query}"`;
3271
3261
  const results = await confluenceSearch(cql);
3272
3262
  if (options.verbose) {
3273
- console.log(results);
3263
+ console.log(JSON.stringify(results, null, 2));
3274
3264
  } else {
3275
3265
  for (const result of results) {
3276
3266
  const id = result.content.id;
@@ -3283,9 +3273,7 @@ function create19() {
3283
3273
  return program2;
3284
3274
  }
3285
3275
  var git_confluence_page_search_default = create19;
3286
- if (isMain("git-confluence-page-search")) {
3287
- await create19().parseAsync(Bun.argv);
3288
- }
3276
+ await runMain("git-confluence-page-search", create19);
3289
3277
 
3290
3278
  // bin/git-confluence-page-show.ts
3291
3279
  var version20 = await getPackageVersion();
@@ -3311,7 +3299,7 @@ function create20() {
3311
3299
  process.exit(1);
3312
3300
  }
3313
3301
  } else if (options.verbose) {
3314
- console.log(page);
3302
+ console.log(JSON.stringify(page, null, 2));
3315
3303
  } else {
3316
3304
  const { host } = await getConfluenceConfig();
3317
3305
  const url = `https://${host}/wiki/spaces/${page.spaceId}/pages/${page.id}`;
@@ -3325,9 +3313,7 @@ function create20() {
3325
3313
  return program2;
3326
3314
  }
3327
3315
  var git_confluence_page_show_default = create20;
3328
- if (isMain("git-confluence-page-show")) {
3329
- await create20().parseAsync(Bun.argv);
3330
- }
3316
+ await runMain("git-confluence-page-show", create20);
3331
3317
 
3332
3318
  // bin/git-confluence-page-update.ts
3333
3319
  var version21 = await getPackageVersion();
@@ -3370,7 +3356,7 @@ function create21() {
3370
3356
  };
3371
3357
  const result = await confluenceApiWrite(`pages/${id}`, "PUT", body);
3372
3358
  if (options.verbose) {
3373
- console.log(result);
3359
+ console.log(JSON.stringify(result, null, 2));
3374
3360
  } else {
3375
3361
  console.log(`Updated page ${result.id} "${result.title}" to version ${result.version.number}`);
3376
3362
  }
@@ -3378,9 +3364,7 @@ function create21() {
3378
3364
  return program2;
3379
3365
  }
3380
3366
  var git_confluence_page_update_default = create21;
3381
- if (isMain("git-confluence-page-update")) {
3382
- await create21().parseAsync(Bun.argv);
3383
- }
3367
+ await runMain("git-confluence-page-update", create21);
3384
3368
 
3385
3369
  // bin/git-confluence-page.ts
3386
3370
  var version22 = await getPackageVersion();
@@ -3390,9 +3374,7 @@ function create22() {
3390
3374
  return program2;
3391
3375
  }
3392
3376
  var git_confluence_page_default = create22;
3393
- if (isMain("git-confluence-page")) {
3394
- await create22().parseAsync(Bun.argv);
3395
- }
3377
+ await runMain("git-confluence-page", create22);
3396
3378
 
3397
3379
  // bin/git-bump.ts
3398
3380
  var version23 = await getPackageVersion();
@@ -3413,9 +3395,7 @@ function create23() {
3413
3395
  return program2;
3414
3396
  }
3415
3397
  var git_bump_default = create23;
3416
- if (isMain("git-bump")) {
3417
- await create23().parseAsync(Bun.argv);
3418
- }
3398
+ await runMain("git-bump", create23);
3419
3399
 
3420
3400
  // lib/jira.ts
3421
3401
  var gitEmailP3 = getConfig("user.email");
@@ -3453,6 +3433,10 @@ async function jiraApi(endpoint) {
3453
3433
  };
3454
3434
  const request = new Request(uri, options);
3455
3435
  const response = await fetch(request);
3436
+ if (!response.ok) {
3437
+ const text = await response.text();
3438
+ throw new Error(`Jira API ${endpoint} failed (${response.status}): ${text}`);
3439
+ }
3456
3440
  const result = await response.json();
3457
3441
  return result;
3458
3442
  }
@@ -3474,7 +3458,7 @@ async function myUnresolvedIssues() {
3474
3458
  // bin/git-jira-start.ts
3475
3459
  var version24 = await getPackageVersion();
3476
3460
  function toKebab(s) {
3477
- return s.replace(/([a-z]+)([A-Z]+)/g, "$1_2").toLowerCase().replace(/(\W+)/g, "-").replace(/-$/, "");
3461
+ return s.replace(/([a-z]+)([A-Z]+)/g, "$1_$2").toLowerCase().replace(/(\W+)/g, "-").replace(/-$/, "");
3478
3462
  }
3479
3463
  function create24() {
3480
3464
  const program2 = new Command;
@@ -3491,9 +3475,7 @@ function create24() {
3491
3475
  return program2;
3492
3476
  }
3493
3477
  var git_jira_start_default = create24;
3494
- if (isMain("git-jira-start")) {
3495
- await create24().parseAsync(Bun.argv);
3496
- }
3478
+ await runMain("git-jira-start", create24);
3497
3479
 
3498
3480
  // bin/git-lab-group-list.ts
3499
3481
  var version25 = await getPackageVersion();
@@ -3502,21 +3484,19 @@ function create25() {
3502
3484
  program2.version(version25).name("list").description("List groups for the current user").option("-v, --verbose", "Verbose output").action(async (options) => {
3503
3485
  const groups = await getGroups();
3504
3486
  if (options.verbose)
3505
- console.log(groups);
3487
+ console.log(JSON.stringify(groups, null, 2));
3506
3488
  else {
3507
3489
  const filtered = groups.map((g) => {
3508
3490
  const { id, name, full_path } = g;
3509
3491
  return { id, name, full_path };
3510
3492
  });
3511
- console.log(filtered);
3493
+ console.log(JSON.stringify(filtered, null, 2));
3512
3494
  }
3513
3495
  });
3514
3496
  return program2;
3515
3497
  }
3516
3498
  var git_lab_group_list_default = create25;
3517
- if (isMain("git-lab-group-list")) {
3518
- await create25().parseAsync(Bun.argv);
3519
- }
3499
+ await runMain("git-lab-group-list", create25);
3520
3500
 
3521
3501
  // bin/git-confluence-space.ts
3522
3502
  var version26 = await getPackageVersion();
@@ -3526,9 +3506,7 @@ function create26() {
3526
3506
  return program2;
3527
3507
  }
3528
3508
  var git_confluence_space_default = create26;
3529
- if (isMain("git-confluence-space")) {
3530
- await create26().parseAsync(Bun.argv);
3531
- }
3509
+ await runMain("git-confluence-space", create26);
3532
3510
 
3533
3511
  // bin/git-jira-issue-list.ts
3534
3512
  var version27 = await getPackageVersion();
@@ -3544,9 +3522,7 @@ function create27() {
3544
3522
  return program2;
3545
3523
  }
3546
3524
  var git_jira_issue_list_default = create27;
3547
- if (isMain("git-jira-issue-list")) {
3548
- await create27().parseAsync(Bun.argv);
3549
- }
3525
+ await runMain("git-jira-issue-list", create27);
3550
3526
 
3551
3527
  // bin/git-jira-issue-show.ts
3552
3528
  var version28 = await getPackageVersion();
@@ -3559,7 +3535,7 @@ function create28() {
3559
3535
  process.exit(1);
3560
3536
  }
3561
3537
  if (options.verbose) {
3562
- console.log(issue);
3538
+ console.log(JSON.stringify(issue, null, 2));
3563
3539
  } else {
3564
3540
  const { host } = await getJiraConfig();
3565
3541
  const summary = issue.fields.summary;
@@ -3570,9 +3546,7 @@ function create28() {
3570
3546
  return program2;
3571
3547
  }
3572
3548
  var git_jira_issue_show_default = create28;
3573
- if (isMain("git-jira-issue-show")) {
3574
- await create28().parseAsync(Bun.argv);
3575
- }
3549
+ await runMain("git-jira-issue-show", create28);
3576
3550
 
3577
3551
  // bin/git-jira-issue.ts
3578
3552
  var version29 = await getPackageVersion();
@@ -3582,9 +3556,7 @@ function create29() {
3582
3556
  return program2;
3583
3557
  }
3584
3558
  var git_jira_issue_default = create29;
3585
- if (isMain("git-jira-issue")) {
3586
- await create29().parseAsync(Bun.argv);
3587
- }
3559
+ await runMain("git-jira-issue", create29);
3588
3560
 
3589
3561
  // bin/git-jira-whoami.ts
3590
3562
  var version30 = await getPackageVersion();
@@ -3593,7 +3565,7 @@ function create30() {
3593
3565
  program2.version(version30).name("whoami").description("Show the current Jira user").option("-v, --verbose", "Verbose output").action(async (options) => {
3594
3566
  const myself = await getMyself();
3595
3567
  if (options.verbose) {
3596
- console.log(myself);
3568
+ console.log(JSON.stringify(myself, null, 2));
3597
3569
  } else {
3598
3570
  const { displayName, emailAddress, accountId } = myself;
3599
3571
  console.log({ displayName, emailAddress, accountId });
@@ -3602,9 +3574,7 @@ function create30() {
3602
3574
  return program2;
3603
3575
  }
3604
3576
  var git_jira_whoami_default = create30;
3605
- if (isMain("git-jira-whoami")) {
3606
- await create30().parseAsync(Bun.argv);
3607
- }
3577
+ await runMain("git-jira-whoami", create30);
3608
3578
 
3609
3579
  // bin/git-lab-group.ts
3610
3580
  var version31 = await getPackageVersion();
@@ -3614,9 +3584,7 @@ function create31() {
3614
3584
  return program2;
3615
3585
  }
3616
3586
  var git_lab_group_default = create31;
3617
- if (isMain("git-lab-group")) {
3618
- await create31().parseAsync(Bun.argv);
3619
- }
3587
+ await runMain("git-lab-group", create31);
3620
3588
 
3621
3589
  // bin/git-lab-whoami.ts
3622
3590
  var version32 = await getPackageVersion();
@@ -3629,7 +3597,7 @@ function create32() {
3629
3597
  process.exit(1);
3630
3598
  }
3631
3599
  if (options.verbose) {
3632
- console.log(user2);
3600
+ console.log(JSON.stringify(user2, null, 2));
3633
3601
  process.exit(0);
3634
3602
  } else {
3635
3603
  console.log(user2.username);
@@ -3638,21 +3606,25 @@ function create32() {
3638
3606
  return program2;
3639
3607
  }
3640
3608
  var git_lab_whoami_default = create32;
3641
- if (isMain("git-lab-whoami")) {
3642
- await create32().parseAsync(Bun.argv);
3643
- }
3609
+ await runMain("git-lab-whoami", create32);
3644
3610
 
3645
3611
  // bin/git-lab.ts
3646
3612
  var version33 = await getPackageVersion();
3647
3613
  function create33() {
3648
3614
  const program2 = new Command;
3649
- program2.version(version33).name("lab").description("Commands for working with GitLab").addCommand(git_lab_group_default()).addCommand(git_lab_merge_default()).addCommand(git_lab_namespace_default()).addCommand(git_lab_project_default()).addCommand(git_lab_whoami_default()).action(() => program2.help());
3615
+ program2.version(version33).name("lab").description("Commands for working with GitLab").addCommand(git_lab_group_default()).addCommand(git_lab_merge_default()).addCommand(git_lab_namespace_default()).addCommand(git_lab_project_default()).addCommand(git_lab_whoami_default()).action(() => program2.help()).addHelpText("after", `
3616
+ Required git config:
3617
+ gitlab.token your GitLab personal access token
3618
+
3619
+ Optional git config:
3620
+ gitlab.host your GitLab hostname (defaults to gitlab.com)
3621
+ gitlab.user your GitLab email (falls back to user.email)
3622
+
3623
+ Set with: git config --global gitlab.token <value>`);
3650
3624
  return program2;
3651
3625
  }
3652
3626
  var git_lab_default = create33;
3653
- if (isMain("git-lab")) {
3654
- await create33().parseAsync(Bun.argv);
3655
- }
3627
+ await runMain("git-lab", create33);
3656
3628
 
3657
3629
  // bin/git-confluence-whoami.ts
3658
3630
  var version34 = await getPackageVersion();
@@ -3661,7 +3633,7 @@ function create34() {
3661
3633
  program2.version(version34).name("whoami").description("Show the current Confluence user").option("-v, --verbose", "Verbose output").action(async (options) => {
3662
3634
  const myself = await confluenceApiV1("user/current");
3663
3635
  if (options.verbose) {
3664
- console.log(myself);
3636
+ console.log(JSON.stringify(myself, null, 2));
3665
3637
  } else {
3666
3638
  const { displayName, email, accountId } = myself;
3667
3639
  console.log({ displayName, email, accountId });
@@ -3670,21 +3642,25 @@ function create34() {
3670
3642
  return program2;
3671
3643
  }
3672
3644
  var git_confluence_whoami_default = create34;
3673
- if (isMain("git-confluence-whoami")) {
3674
- await create34().parseAsync(Bun.argv);
3675
- }
3645
+ await runMain("git-confluence-whoami", create34);
3676
3646
 
3677
3647
  // bin/git-jira.ts
3678
3648
  var version35 = await getPackageVersion();
3679
3649
  function create35() {
3680
3650
  const program2 = new Command;
3681
- program2.version(version35).name("jira").description("Commands for working with Jira").addCommand(git_jira_start_default()).addCommand(git_jira_issue_default()).addCommand(git_jira_issue_list_default()).addCommand(git_jira_whoami_default());
3651
+ program2.version(version35).name("jira").description("Commands for working with Jira").addCommand(git_jira_start_default()).addCommand(git_jira_issue_default()).addCommand(git_jira_issue_list_default()).addCommand(git_jira_whoami_default()).addHelpText("after", `
3652
+ Required git config:
3653
+ jira.host your Jira hostname (e.g. yourcompany.atlassian.net)
3654
+ jira.token your Atlassian API token
3655
+
3656
+ Optional git config:
3657
+ jira.user your Jira email (falls back to user.email)
3658
+
3659
+ Set with: git config --global jira.host <value>`);
3682
3660
  return program2;
3683
3661
  }
3684
3662
  var git_jira_default = create35;
3685
- if (isMain("git-jira")) {
3686
- await create35().parseAsync(Bun.argv);
3687
- }
3663
+ await runMain("git-jira", create35);
3688
3664
 
3689
3665
  // lib/api.ts
3690
3666
  var services = {
@@ -3736,6 +3712,16 @@ async function apiRequest(serviceName, method, endpoint, options) {
3736
3712
  }
3737
3713
  const request = new Request(url, fetchOptions);
3738
3714
  const response = await fetch(request);
3715
+ if (!response.ok) {
3716
+ const text = await response.text();
3717
+ let body2;
3718
+ try {
3719
+ body2 = JSON.parse(text);
3720
+ } catch {
3721
+ throw new Error(`${serviceName} API ${method} ${endpoint} failed (${response.status}): ${text}`);
3722
+ }
3723
+ return { status: response.status, headers: response.headers, body: body2 };
3724
+ }
3739
3725
  const body = await response.json();
3740
3726
  return {
3741
3727
  status: response.status,
@@ -3779,7 +3765,13 @@ async function apiPaginate(serviceName, endpoint, options) {
3779
3765
  lastStatus = response.status;
3780
3766
  lastHeaders = response.headers;
3781
3767
  if (!response.ok) {
3782
- const body2 = await response.json();
3768
+ const text = await response.text();
3769
+ let body2;
3770
+ try {
3771
+ body2 = JSON.parse(text);
3772
+ } catch {
3773
+ throw new Error(`${serviceName} API paginate ${endpoint} failed (${response.status}): ${text}`);
3774
+ }
3783
3775
  return { status: response.status, headers: response.headers, body: body2 };
3784
3776
  }
3785
3777
  const body = await response.json();
@@ -3848,26 +3840,29 @@ function create36() {
3848
3840
  return program2;
3849
3841
  }
3850
3842
  var git_api_default = create36;
3851
- if (isMain("git-api")) {
3852
- await create36().parseAsync(Bun.argv);
3853
- }
3843
+ await runMain("git-api", create36);
3854
3844
 
3855
3845
  // bin/git-confluence.ts
3856
3846
  var version37 = await getPackageVersion();
3857
3847
  function create37() {
3858
3848
  const program2 = new Command;
3859
- program2.version(version37).name("confluence").description("Commands for working with Confluence").addCommand(git_confluence_whoami_default()).addCommand(git_confluence_space_default()).addCommand(git_confluence_page_default());
3849
+ program2.version(version37).name("confluence").description("Commands for working with Confluence").addCommand(git_confluence_whoami_default()).addCommand(git_confluence_space_default()).addCommand(git_confluence_page_default()).addHelpText("after", `
3850
+ Required git config:
3851
+ confluence.host your Confluence hostname (or jira.host as fallback)
3852
+ confluence.token your Atlassian API token (or jira.token as fallback)
3853
+
3854
+ Optional git config:
3855
+ confluence.user your Confluence email (falls back to jira.user, then user.email)
3856
+
3857
+ Set with: git config --global confluence.host <value>`);
3860
3858
  return program2;
3861
3859
  }
3862
3860
  var git_confluence_default = create37;
3863
- if (isMain("git-confluence")) {
3864
- await create37().parseAsync(Bun.argv);
3865
- }
3861
+ await runMain("git-confluence", create37);
3866
3862
 
3867
3863
  // bin/gitj-install-skills.ts
3868
3864
  import fs2 from "fs";
3869
3865
  import path4 from "path";
3870
- import os from "os";
3871
3866
  var version38 = await getPackageVersion();
3872
3867
  var frameworks = ["opencode", "copilot", "claude"];
3873
3868
  var skillNames = ["git-jira", "git-lab", "git-confluence"];
@@ -3884,14 +3879,14 @@ function getSkillsSourceDir() {
3884
3879
  return skillsDir;
3885
3880
  }
3886
3881
  function getTargetDir(framework) {
3887
- const home = os.homedir();
3882
+ const cwd = process.cwd();
3888
3883
  switch (framework) {
3889
3884
  case "opencode":
3890
- return path4.join(home, ".config", "opencode", "skills");
3885
+ return path4.join(cwd, ".opencode", "skills");
3891
3886
  case "copilot":
3892
- return path4.join(home, ".copilot", "skills");
3887
+ return path4.join(cwd, ".github", "skills");
3893
3888
  case "claude":
3894
- return path4.join(process.cwd(), ".claude", "skills");
3889
+ return path4.join(cwd, ".claude", "skills");
3895
3890
  }
3896
3891
  }
3897
3892
  function installSkills(framework, copy) {
@@ -3940,24 +3935,25 @@ function forceInstallSkills(framework, copy) {
3940
3935
  }
3941
3936
  function create38() {
3942
3937
  const program2 = new Command;
3943
- program2.version(version38).name("install-skills").description("Install AI agent skills for a coding framework").argument("<framework>", `framework to install for (${frameworks.join(", ")})`).option("--copy", "copy files instead of creating symlinks").option("--force", "overwrite existing skill directories").action(async (framework, options) => {
3938
+ program2.version(version38).name("install-skills").description("Install AI agent skills for a coding framework").argument("<framework>", `framework to install for (${frameworks.join(", ")})`).option("--copy", "copy files instead of creating symlinks (automatic in Docker)").option("--force", "overwrite existing skill directories").action(async (framework, options) => {
3944
3939
  if (!frameworks.includes(framework)) {
3945
3940
  console.error(`Unknown framework: ${framework}`);
3946
3941
  console.error(`Supported frameworks: ${frameworks.join(", ")}`);
3947
3942
  process.exit(1);
3948
3943
  }
3944
+ const sourceDir = getSkillsSourceDir();
3945
+ const inDocker = sourceDir.startsWith("/app/");
3946
+ const copy = !!(options.copy || inDocker);
3949
3947
  if (options.force) {
3950
- forceInstallSkills(framework, !!options.copy);
3948
+ forceInstallSkills(framework, copy);
3951
3949
  } else {
3952
- installSkills(framework, !!options.copy);
3950
+ installSkills(framework, copy);
3953
3951
  }
3954
3952
  });
3955
3953
  return program2;
3956
3954
  }
3957
3955
  var gitj_install_skills_default = create38;
3958
- if (isMain("gitj-install-skills")) {
3959
- await create38().parseAsync(Bun.argv);
3960
- }
3956
+ await runMain("gitj-install-skills", create38);
3961
3957
 
3962
3958
  // lib/help.ts
3963
3959
  function formatCommandTree(cmd) {
@@ -4010,7 +4006,12 @@ function create39() {
4010
4006
  return program2;
4011
4007
  }
4012
4008
  var command = create39();
4013
- await command.parseAsync(Bun.argv);
4009
+ try {
4010
+ await command.parseAsync(Bun.argv);
4011
+ } catch (err) {
4012
+ console.error(`error: ${err instanceof Error ? err.message : String(err)}`);
4013
+ process.exit(1);
4014
+ }
4014
4015
  export {
4015
4016
  create39 as create
4016
4017
  };