git-digger 1.9.23 → 1.9.25

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/README.md CHANGED
@@ -97,6 +97,161 @@ eg:
97
97
  commit message: `-3- I did that thing`
98
98
  produces: { ease: 3 }
99
99
 
100
+ ## Structured Output
101
+
102
+ Both commands support machine-readable JSON output for CI/CD pipelines and automation scripts via the `--format` flag.
103
+
104
+ ### Format Options
105
+
106
+ - `--format=text` (default): Writes JSON to a file and prints a confirmation message
107
+ - `--format=json`: Outputs structured JSON to stdout wrapped in a status envelope
108
+
109
+ ### Text Mode (Default)
110
+
111
+ **Example command:**
112
+ ```bash
113
+ digger current-contribution-data $(pwd)
114
+ ```
115
+
116
+ **Output:**
117
+ ```
118
+ Data written to currentContributionData.json
119
+ ```
120
+
121
+ The JSON data is written to `currentContributionData.json` (or the file specified by `--output-file`).
122
+
123
+ ### JSON Mode
124
+
125
+ **Example command:**
126
+ ```bash
127
+ digger current-contribution-data $(pwd) --format=json
128
+ ```
129
+
130
+ **Success response:**
131
+ ```json
132
+ {
133
+ "status": "success",
134
+ "data": {
135
+ "storyId": "STORY-123",
136
+ "contributors": [
137
+ {
138
+ "email": "user@example.com",
139
+ "name": "John Doe"
140
+ }
141
+ ],
142
+ "commits": [
143
+ {
144
+ "sha": "abc123",
145
+ "message": "[STORY-123] [patch] Fix bug",
146
+ "dateTime": "2026-05-19T10:30:00Z"
147
+ }
148
+ ],
149
+ "semver": "Patch",
150
+ "label": "my-project",
151
+ "firstCommitDateTime": "2026-05-19T10:30:00Z",
152
+ "lastCommitDateTime": "2026-05-19T10:30:00Z",
153
+ "ease": 3
154
+ }
155
+ }
156
+ ```
157
+
158
+ **Fields:**
159
+ - `status`: Always `"success"` for valid operations
160
+ - `data`: The contribution data object (see [ContributionDataJson.kt](../digger-json/src/commonMain/kotlin/com/zegreatrob/tools/digger/json/ContributionDataJson.kt) for full schema)
161
+ - `data.storyId`: Story identifier parsed from commit messages
162
+ - `data.contributors`: Array of contributor objects with email and name
163
+ - `data.commits`: Array of commit objects
164
+ - `data.semver`: Semantic version type (`"Major"`, `"Minor"`, `"Patch"`, `"None"`)
165
+ - `data.label`: Repository or project label
166
+ - `data.firstCommitDateTime`: ISO 8601 timestamp of first commit
167
+ - `data.lastCommitDateTime`: ISO 8601 timestamp of last commit
168
+ - `data.ease`: Joy/ease score (1-5) parsed from commit messages
169
+
170
+ ### AllContributionData JSON Mode
171
+
172
+ **Example command:**
173
+ ```bash
174
+ digger all-contribution-data $(pwd) --format=json
175
+ ```
176
+
177
+ **Success response:**
178
+ ```json
179
+ {
180
+ "status": "success",
181
+ "data": [
182
+ {
183
+ "storyId": "STORY-123",
184
+ "contributors": [...],
185
+ "commits": [...],
186
+ "semver": "Patch",
187
+ "label": "my-project",
188
+ "firstCommitDateTime": "2026-05-19T10:30:00Z",
189
+ "lastCommitDateTime": "2026-05-19T10:30:00Z",
190
+ "ease": 3
191
+ },
192
+ {
193
+ "storyId": "STORY-124",
194
+ ...
195
+ }
196
+ ]
197
+ }
198
+ ```
199
+
200
+ The `data` field contains an array of contribution data objects, one for each contribution period.
201
+
202
+ ### CI Integration Examples
203
+
204
+ **Extract story ID in GitHub Actions:**
205
+ ```yaml
206
+ - name: Get current contribution
207
+ id: contribution
208
+ run: |
209
+ STORY_ID=$(digger current-contribution-data $(pwd) --format=json | jq -r '.data.storyId')
210
+ echo "story-id=$STORY_ID" >> $GITHUB_OUTPUT
211
+
212
+ - name: Use story ID
213
+ run: echo "Current story: ${{ steps.contribution.outputs.story-id }}"
214
+ ```
215
+
216
+ **Extract contributor list in bash:**
217
+ ```bash
218
+ # Get contributors
219
+ CONTRIBUTORS=$(digger current-contribution-data $(pwd) --format=json | jq -r '.data.contributors[].name')
220
+
221
+ echo "Contributors:"
222
+ echo "$CONTRIBUTORS"
223
+ ```
224
+
225
+ **Check semver type:**
226
+ ```bash
227
+ OUTPUT=$(digger current-contribution-data $(pwd) --format=json 2>/dev/null)
228
+ SEMVER=$(echo "$OUTPUT" | jq -r '.data.semver')
229
+
230
+ case "$SEMVER" in
231
+ "Major")
232
+ echo "Breaking change detected"
233
+ ;;
234
+ "Minor")
235
+ echo "New feature detected"
236
+ ;;
237
+ "Patch")
238
+ echo "Bug fix detected"
239
+ ;;
240
+ "None")
241
+ echo "No version bump"
242
+ ;;
243
+ esac
244
+ ```
245
+
246
+ **Extract all story IDs:**
247
+ ```bash
248
+ # Get all contributions and extract story IDs
249
+ STORY_IDS=$(digger all-contribution-data $(pwd) --format=json | jq -r '.data[].storyId' | sort -u)
250
+
251
+ echo "All story IDs:"
252
+ echo "$STORY_IDS"
253
+ ```
254
+
100
255
  ## Help
101
256
 
102
257
  For a full listing of the available options in the program, please use the built-in help command.
@@ -1,22 +1,22 @@
1
1
  (function (_, kotlin_clikt_clikt, kotlin_kotlin, kotlin_mordant_mordant) {
2
2
  'use strict';
3
3
  //region block: imports
4
- var CoreCliktCommand = kotlin_clikt_clikt.$_$.b;
4
+ var CoreCliktCommand = kotlin_clikt_clikt.$_$.a;
5
5
  var VOID = kotlin_kotlin.$_$.c;
6
6
  var Unit_instance = kotlin_kotlin.$_$.v;
7
7
  var protoOf = kotlin_kotlin.$_$.da;
8
8
  var initMetadataForClass = kotlin_kotlin.$_$.f9;
9
- var selfAndAncestors = kotlin_clikt_clikt.$_$.f;
9
+ var selfAndAncestors = kotlin_clikt_clikt.$_$.e;
10
10
  var mapNotNull = kotlin_kotlin.$_$.ib;
11
11
  var firstOrNull = kotlin_kotlin.$_$.db;
12
12
  var Terminal_init_$Create$ = kotlin_mordant_mordant.$_$.h;
13
13
  var last = kotlin_kotlin.$_$.hb;
14
14
  var MultiplatformSystem_instance = kotlin_mordant_mordant.$_$.e;
15
- var FileNotFound = kotlin_clikt_clikt.$_$.c;
15
+ var FileNotFound = kotlin_clikt_clikt.$_$.b;
16
16
  var Terminal = kotlin_mordant_mordant.$_$.b;
17
17
  var Whitespace_NORMAL_getInstance = kotlin_mordant_mordant.$_$.f;
18
18
  var Text_init_$Create$ = kotlin_mordant_mordant.$_$.i;
19
- var AbstractHelpFormatter = kotlin_clikt_clikt.$_$.h;
19
+ var AbstractHelpFormatter = kotlin_clikt_clikt.$_$.g;
20
20
  var verticalLayout = kotlin_mordant_mordant.$_$.a;
21
21
  var charSequenceLength = kotlin_kotlin.$_$.w8;
22
22
  var definitionList = kotlin_mordant_mordant.$_$.c;
@@ -66,10 +66,10 @@
66
66
  return new MordantHelpFormatter(it);
67
67
  }
68
68
  function installMordant$lambda$lambda_0(it) {
69
- return MultiplatformSystem_instance.e26(it);
69
+ return MultiplatformSystem_instance.f26(it);
70
70
  }
71
71
  function installMordant$lambda$lambda_1(it) {
72
- var tmp0_elvis_lhs = MultiplatformSystem_instance.g26(it);
72
+ var tmp0_elvis_lhs = MultiplatformSystem_instance.h26(it);
73
73
  var tmp;
74
74
  if (tmp0_elvis_lhs == null) {
75
75
  throw new FileNotFound(it);
@@ -79,14 +79,14 @@
79
79
  return tmp;
80
80
  }
81
81
  function installMordant$lambda$lambda_2(it) {
82
- MultiplatformSystem_instance.f26(it);
82
+ MultiplatformSystem_instance.g26(it);
83
83
  return Unit_instance;
84
84
  }
85
85
  function installMordant$lambda$lambda_3(context, message, trailingNewline, err) {
86
86
  if (trailingNewline) {
87
- get_terminal(context).e2g(message, VOID, VOID, VOID, VOID, err);
87
+ get_terminal(context).f2g(message, VOID, VOID, VOID, VOID, err);
88
88
  } else {
89
- get_terminal(context).c2g(message, VOID, VOID, VOID, VOID, err);
89
+ get_terminal(context).d2g(message, VOID, VOID, VOID, VOID, err);
90
90
  }
91
91
  return Unit_instance;
92
92
  }
@@ -117,21 +117,21 @@
117
117
  }
118
118
  function MordantHelpFormatter$formatHelp$lambda(this$0, $error, $prolog, $epilog, $parameters, $programName) {
119
119
  return function ($this$verticalLayout) {
120
- $this$verticalLayout.u2c(1);
121
- $this$verticalLayout.r2c(this$0.r1q($error, $prolog, $epilog, $parameters, $programName));
120
+ $this$verticalLayout.v2c(1);
121
+ $this$verticalLayout.s2c(this$0.r1q($error, $prolog, $epilog, $parameters, $programName));
122
122
  return Unit_instance;
123
123
  };
124
124
  }
125
125
  function MordantHelpFormatter$renderUsage$lambda($prog, $usageParts) {
126
126
  return function ($this$definitionList) {
127
- $this$definitionList.o2g($prog, Text_init_$Create$($usageParts, Whitespace_NORMAL_getInstance()));
128
- $this$definitionList.i2g_1 = true;
129
- $this$definitionList.l2g(1);
127
+ $this$definitionList.p2g($prog, Text_init_$Create$($usageParts, Whitespace_NORMAL_getInstance()));
128
+ $this$definitionList.j2g_1 = true;
129
+ $this$definitionList.m2g(1);
130
130
  return Unit_instance;
131
131
  };
132
132
  }
133
133
  function MordantHelpFormatter$renderProlog$lambda($this$withPadding) {
134
- $this$withPadding.r2e_1 = 2;
134
+ $this$withPadding.s2e_1 = 2;
135
135
  return Unit_instance;
136
136
  }
137
137
  function MordantHelpFormatter$renderParameters$lambda(this$0, $parameters) {
@@ -139,31 +139,31 @@
139
139
  var _iterator__ex2g4s = this$0.e1s($parameters).r();
140
140
  while (_iterator__ex2g4s.s()) {
141
141
  var section = _iterator__ex2g4s.t();
142
- $this$definitionList.o2g(section.y1p_1, section.z1p_1);
142
+ $this$definitionList.p2g(section.y1p_1, section.z1p_1);
143
143
  }
144
144
  return Unit_instance;
145
145
  };
146
146
  }
147
147
  function MordantHelpFormatter$renderOptionGroup$lambda($this$withPadding) {
148
- $this$withPadding.o2e_1 = 1;
149
- $this$withPadding.r2e_1 = 2;
150
- $this$withPadding.q2e_1 = 1;
148
+ $this$withPadding.p2e_1 = 1;
149
+ $this$withPadding.s2e_1 = 2;
150
+ $this$withPadding.r2e_1 = 1;
151
151
  return Unit_instance;
152
152
  }
153
153
  function MordantHelpFormatter$renderOptionGroup$lambda_0($markdown, this$0, $options) {
154
154
  return function ($this$verticalLayout) {
155
- $this$verticalLayout.t2c($markdown);
156
- $this$verticalLayout.t2c(this$0.o1s($options));
155
+ $this$verticalLayout.u2c($markdown);
156
+ $this$verticalLayout.u2c(this$0.o1s($options));
157
157
  return Unit_instance;
158
158
  };
159
159
  }
160
160
  function MordantHelpFormatter$buildParameterList$lambda($rows, this$0) {
161
161
  return function ($this$definitionList) {
162
- $this$definitionList.i2g_1 = true;
162
+ $this$definitionList.j2g_1 = true;
163
163
  var _iterator__ex2g4s = $rows.r();
164
164
  while (_iterator__ex2g4s.s()) {
165
165
  var row = _iterator__ex2g4s.t();
166
- $this$definitionList.p2g(this$0.j1t(row), this$0.k1t(row));
166
+ $this$definitionList.q2g(this$0.k1t(row), this$0.l1t(row));
167
167
  }
168
168
  return Unit_instance;
169
169
  };
@@ -174,18 +174,18 @@
174
174
  showRequiredTag = showRequiredTag === VOID ? false : showRequiredTag;
175
175
  AbstractHelpFormatter.call(this, context, requiredOptionMarker, showDefaultValues, showRequiredTag);
176
176
  }
177
- protoOf(MordantHelpFormatter).t2h = function () {
178
- return get_terminal(this.f1q_1).n29_1;
177
+ protoOf(MordantHelpFormatter).u2h = function () {
178
+ return get_terminal(this.f1q_1).o29_1;
179
179
  };
180
180
  protoOf(MordantHelpFormatter).c1k = function (error, prolog, epilog, parameters, programName) {
181
181
  var widget = verticalLayout(MordantHelpFormatter$formatHelp$lambda(this, error, prolog, epilog, parameters, programName));
182
- return get_terminal(this.f1q_1).f2g(widget);
182
+ return get_terminal(this.f1q_1).g2g(widget);
183
183
  };
184
184
  protoOf(MordantHelpFormatter).t1q = function (parameters, error) {
185
185
  return Text_init_$Create$(this.x1q(parameters, error));
186
186
  };
187
187
  protoOf(MordantHelpFormatter).s1q = function (parameters, programName) {
188
- var title = this.u2h(this.q1q().e1t());
188
+ var title = this.v2h(this.q1q().f1t());
189
189
  var prog = title + ' ' + programName;
190
190
  var usageParts = this.b1r(parameters);
191
191
  var tmp;
@@ -198,11 +198,11 @@
198
198
  return tmp;
199
199
  };
200
200
  protoOf(MordantHelpFormatter).u1q = function (prolog) {
201
- var tmp = this.v2h(prolog);
201
+ var tmp = this.w2h(prolog);
202
202
  return withPadding(tmp, false, MordantHelpFormatter$renderProlog$lambda);
203
203
  };
204
204
  protoOf(MordantHelpFormatter).w1q = function (epilog) {
205
- return this.v2h(epilog);
205
+ return this.w2h(epilog);
206
206
  };
207
207
  protoOf(MordantHelpFormatter).v1q = function (parameters) {
208
208
  return definitionList(MordantHelpFormatter$renderParameters$lambda(this, parameters));
@@ -220,7 +220,7 @@
220
220
  var options = destination;
221
221
  if (help == null)
222
222
  return this.o1s(options);
223
- var tmp = this.v2h(help);
223
+ var tmp = this.w2h(help);
224
224
  var markdown = withPadding(tmp, false, MordantHelpFormatter$renderOptionGroup$lambda);
225
225
  return verticalLayout(MordantHelpFormatter$renderOptionGroup$lambda_0(markdown, this, options));
226
226
  };
@@ -230,36 +230,36 @@
230
230
  return '<' + name.toLowerCase() + '>';
231
231
  };
232
232
  protoOf(MordantHelpFormatter).m1s = function (name) {
233
- return this.t2h().c29('danger').a22(name);
233
+ return this.u2h().d29('danger').b22(name);
234
234
  };
235
235
  protoOf(MordantHelpFormatter).v1s = function (name) {
236
- return this.t2h().c29('muted').a22(name);
236
+ return this.u2h().d29('muted').b22(name);
237
237
  };
238
238
  protoOf(MordantHelpFormatter).l1q = function (name) {
239
- return this.t2h().c29('info').a22(name);
239
+ return this.u2h().d29('info').b22(name);
240
240
  };
241
241
  protoOf(MordantHelpFormatter).o1q = function (name) {
242
- return this.t2h().c29('info').a22(name);
242
+ return this.u2h().d29('info').b22(name);
243
243
  };
244
244
  protoOf(MordantHelpFormatter).p1q = function (name) {
245
- return this.t2h().c29('info').a22(name);
245
+ return this.u2h().d29('info').b22(name);
246
246
  };
247
247
  protoOf(MordantHelpFormatter).d1s = function (title) {
248
- return this.t2h().c29('warning').a22(title);
248
+ return this.u2h().d29('warning').b22(title);
249
249
  };
250
- protoOf(MordantHelpFormatter).u2h = function (title) {
251
- return this.t2h().c29('warning').a22(title);
250
+ protoOf(MordantHelpFormatter).v2h = function (title) {
251
+ return this.u2h().d29('warning').b22(title);
252
252
  };
253
253
  protoOf(MordantHelpFormatter).z1q = function (title) {
254
- return this.t2h().c29('danger').a22(title);
254
+ return this.u2h().d29('danger').b22(title);
255
255
  };
256
256
  protoOf(MordantHelpFormatter).e1r = function (parameter) {
257
- return this.t2h().c29('muted').a22(parameter);
257
+ return this.u2h().d29('muted').b22(parameter);
258
258
  };
259
259
  protoOf(MordantHelpFormatter).x1s = function (metavar) {
260
- return this.t2h().c29('warning').r25(this.t2h().c29('muted')).a22(metavar);
260
+ return this.u2h().d29('warning').s25(this.u2h().d29('muted')).b22(metavar);
261
261
  };
262
- protoOf(MordantHelpFormatter).j1t = function (row) {
262
+ protoOf(MordantHelpFormatter).k1t = function (row) {
263
263
  var tmp;
264
264
  // Inline function 'kotlin.text.isNullOrEmpty' call
265
265
  var this_0 = row.c1q_1;
@@ -281,13 +281,13 @@
281
281
  var termPrefix = tmp;
282
282
  return Text_init_$Create$(termPrefix + row.a1q_1, Whitespace_PRE_WRAP_getInstance());
283
283
  };
284
- protoOf(MordantHelpFormatter).k1t = function (row) {
285
- return isBlank(row.b1q_1) ? Text_init_$Create$('') : this.v2h(row.b1q_1);
284
+ protoOf(MordantHelpFormatter).l1t = function (row) {
285
+ return isBlank(row.b1q_1) ? Text_init_$Create$('') : this.w2h(row.b1q_1);
286
286
  };
287
287
  protoOf(MordantHelpFormatter).o1s = function (rows) {
288
288
  return definitionList(MordantHelpFormatter$buildParameterList$lambda(rows, this));
289
289
  };
290
- protoOf(MordantHelpFormatter).v2h = function (text) {
290
+ protoOf(MordantHelpFormatter).w2h = function (text) {
291
291
  return Text_init_$Create$(replace(text, '\n\n', '\x85\x85'), Whitespace_NORMAL_getInstance());
292
292
  };
293
293
  //region block: exports