@cesar-richard/git-connector-sdk 1.57.0 → 1.59.0

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
@@ -265,6 +265,56 @@ The phrase prefix lets the SDK detect refs even when the number is **bare**
265
265
 
266
266
  Code blocks (fenced ```` ``` ```` and inline `` ` ``) are stripped before scanning.
267
267
 
268
+ ### Correlation confidence & billing flags (`attributable`, `resolves`)
269
+
270
+ Every `linkedActivities[]` entry carries billing-grade correlation metadata so a
271
+ client app can decide, **auditably**, what to impute and how to display issue
272
+ status. All fields are optional (only present once an entity has been
273
+ (re)synced under scoring algo `corr-2026.06`).
274
+
275
+ | field | type | meaning |
276
+ |---|---|---|
277
+ | `linkKind` | `"reference" \| "resolution" \| "reverse_comment"` | how the link reads: a mention, an explicit closure, or a link discovered from the issue's own comments |
278
+ | `confidence` | `number \| null` | `[0,1]`. Driven by the **form** of the evidence: canonical URL `0.95` > cross-ref (`group/repo#N`) `0.85` > bare short ref `0.78`; `−0.13` in a title, `+0.07` for a resolution verb; ambiguous heuristic-resolved refs capped at `0.60` |
279
+ | `status` | `"confirmed" \| "candidate"` | `confirmed` when `confidence ≥ 0.75` and unambiguous (or confirmed via bidirectional evidence) |
280
+ | `attributable` | `boolean` | **the flag to use for imputation / billing.** `true` ⇔ `status==='confirmed'`, **any** `linkKind`. A PR that merely references an issue (preparatory work) — or is only linked from the issue's comments — still counts as contribution |
281
+ | `resolves` | `boolean` | `true` ⇔ `confirmed && linkKind==='resolution'`. Use for **issue status**, never for billing |
282
+ | `evidence` | `{ field, text, matchStart, matchEnd } \| null` | the matched snippet + offsets, for human audit |
283
+
284
+ > **Migration note (was `billable`):** the short-lived `billable` field (SDK
285
+ > `1.57.0`) was **removed**. It conflated two questions. Replace it as follows:
286
+ >
287
+ > - imputation / "who worked on this issue" → use **`attributable`** (NOT the
288
+ > old `billable`, which only fired on closures and missed preparatory work and
289
+ > reverse-linked PRs);
290
+ > - "what closed the issue" / status → use **`resolves`** (this is what the old
291
+ > `billable` actually computed).
292
+
293
+ ```ts
294
+ const { data } = await client.GET("/v1/work-items", {
295
+ params: { query: { state: "open" } },
296
+ });
297
+ for (const wi of data.items) {
298
+ // Everyone who contributed to this issue (for a CRA / billing sheet):
299
+ const contributors = new Set(
300
+ wi.linkedActivities
301
+ .filter((pr) => pr.attributable)
302
+ .map((pr) => pr.authorResolved?.login ?? pr.author)
303
+ .filter(Boolean),
304
+ );
305
+
306
+ // Is the issue actually resolved by a merged PR?
307
+ const resolved = wi.linkedActivities.some((pr) => pr.resolves && pr.isMerged);
308
+
309
+ console.log(`${wi.title}: worked on by [${[...contributors].join(", ")}]`, { resolved });
310
+ }
311
+ ```
312
+
313
+ Two PRs in different repos (e.g. a GitHub PR for terraform groundwork + a GitLab
314
+ MR for the feature) that both reference the same issue both show up as
315
+ `attributable` linked activities on that one work item — that's how cross-repo,
316
+ cross-provider work is consolidated: the issue is the pivot.
317
+
268
318
  ### PR review status (`reviewStatus`)
269
319
 
270
320
  Each `LinkedActivity` carries an optional `reviewStatus` field with 8 possible
package/dist/schema.d.ts CHANGED
@@ -281,10 +281,17 @@ export interface components {
281
281
  hintSource: string;
282
282
  kind: string;
283
283
  };
284
+ /** @description Raw link classification: 'reference' (mention), 'resolution' (closes the issue), or 'reverse_comment' (link discovered from the issue's comments pointing back at this PR/MR). */
284
285
  linkKind?: string;
286
+ /** @description Deterministic correlation confidence in [0,1]. Driven by the form of the evidence (canonical URL > cross-ref > bare short ref), with a title penalty and a resolution bonus. Ambiguous heuristic-resolved refs are capped at 0.60. */
285
287
  confidence?: number | null;
288
+ /** @description 'confirmed' when confidence >= 0.75 and the link is unambiguous (or confirmed via bidirectional evidence); otherwise 'candidate'. Only 'confirmed' links are attributable. */
286
289
  status?: string;
287
- billable?: boolean;
290
+ /** @description True when the linked PR/MR CONTRIBUTED to the issue (status === 'confirmed', any linkKind incl. references and reverse links). This is the flag to use for imputation/billing — preparatory work counts. */
291
+ attributable?: boolean;
292
+ /** @description True when the linked PR/MR actually CLOSES the issue (status === 'confirmed' && linkKind === 'resolution'). Use for issue status, NOT for billing. */
293
+ resolves?: boolean;
294
+ /** @description Audit trail: the matched snippet, the field it was found in, and the offsets — so a human can verify why the link was classified this way. */
288
295
  evidence?: {
289
296
  field: string;
290
297
  text: string;
@@ -461,10 +468,17 @@ export interface components {
461
468
  hintSource: string;
462
469
  kind: string;
463
470
  };
471
+ /** @description Raw link classification: 'reference' (mention), 'resolution' (closes the issue), or 'reverse_comment' (link discovered from the issue's comments pointing back at this PR/MR). */
464
472
  linkKind?: string;
473
+ /** @description Deterministic correlation confidence in [0,1]. Driven by the form of the evidence (canonical URL > cross-ref > bare short ref), with a title penalty and a resolution bonus. Ambiguous heuristic-resolved refs are capped at 0.60. */
465
474
  confidence?: number | null;
475
+ /** @description 'confirmed' when confidence >= 0.75 and the link is unambiguous (or confirmed via bidirectional evidence); otherwise 'candidate'. Only 'confirmed' links are attributable. */
466
476
  status?: string;
467
- billable?: boolean;
477
+ /** @description True when the linked PR/MR CONTRIBUTED to the issue (status === 'confirmed', any linkKind incl. references and reverse links). This is the flag to use for imputation/billing — preparatory work counts. */
478
+ attributable?: boolean;
479
+ /** @description True when the linked PR/MR actually CLOSES the issue (status === 'confirmed' && linkKind === 'resolution'). Use for issue status, NOT for billing. */
480
+ resolves?: boolean;
481
+ /** @description Audit trail: the matched snippet, the field it was found in, and the offsets — so a human can verify why the link was classified this way. */
468
482
  evidence?: {
469
483
  field: string;
470
484
  text: string;
@@ -592,10 +606,17 @@ export interface components {
592
606
  hintSource: string;
593
607
  kind: string;
594
608
  };
609
+ /** @description Raw link classification: 'reference' (mention), 'resolution' (closes the issue), or 'reverse_comment' (link discovered from the issue's comments pointing back at this PR/MR). */
595
610
  linkKind?: string;
611
+ /** @description Deterministic correlation confidence in [0,1]. Driven by the form of the evidence (canonical URL > cross-ref > bare short ref), with a title penalty and a resolution bonus. Ambiguous heuristic-resolved refs are capped at 0.60. */
596
612
  confidence?: number | null;
613
+ /** @description 'confirmed' when confidence >= 0.75 and the link is unambiguous (or confirmed via bidirectional evidence); otherwise 'candidate'. Only 'confirmed' links are attributable. */
597
614
  status?: string;
598
- billable?: boolean;
615
+ /** @description True when the linked PR/MR CONTRIBUTED to the issue (status === 'confirmed', any linkKind incl. references and reverse links). This is the flag to use for imputation/billing — preparatory work counts. */
616
+ attributable?: boolean;
617
+ /** @description True when the linked PR/MR actually CLOSES the issue (status === 'confirmed' && linkKind === 'resolution'). Use for issue status, NOT for billing. */
618
+ resolves?: boolean;
619
+ /** @description Audit trail: the matched snippet, the field it was found in, and the offsets — so a human can verify why the link was classified this way. */
599
620
  evidence?: {
600
621
  field: string;
601
622
  text: string;
@@ -772,10 +793,17 @@ export interface operations {
772
793
  hintSource: string;
773
794
  kind: string;
774
795
  };
796
+ /** @description Raw link classification: 'reference' (mention), 'resolution' (closes the issue), or 'reverse_comment' (link discovered from the issue's comments pointing back at this PR/MR). */
775
797
  linkKind?: string;
798
+ /** @description Deterministic correlation confidence in [0,1]. Driven by the form of the evidence (canonical URL > cross-ref > bare short ref), with a title penalty and a resolution bonus. Ambiguous heuristic-resolved refs are capped at 0.60. */
776
799
  confidence?: number | null;
800
+ /** @description 'confirmed' when confidence >= 0.75 and the link is unambiguous (or confirmed via bidirectional evidence); otherwise 'candidate'. Only 'confirmed' links are attributable. */
777
801
  status?: string;
778
- billable?: boolean;
802
+ /** @description True when the linked PR/MR CONTRIBUTED to the issue (status === 'confirmed', any linkKind incl. references and reverse links). This is the flag to use for imputation/billing — preparatory work counts. */
803
+ attributable?: boolean;
804
+ /** @description True when the linked PR/MR actually CLOSES the issue (status === 'confirmed' && linkKind === 'resolution'). Use for issue status, NOT for billing. */
805
+ resolves?: boolean;
806
+ /** @description Audit trail: the matched snippet, the field it was found in, and the offsets — so a human can verify why the link was classified this way. */
779
807
  evidence?: {
780
808
  field: string;
781
809
  text: string;
@@ -907,10 +935,17 @@ export interface operations {
907
935
  hintSource: string;
908
936
  kind: string;
909
937
  };
938
+ /** @description Raw link classification: 'reference' (mention), 'resolution' (closes the issue), or 'reverse_comment' (link discovered from the issue's comments pointing back at this PR/MR). */
910
939
  linkKind?: string;
940
+ /** @description Deterministic correlation confidence in [0,1]. Driven by the form of the evidence (canonical URL > cross-ref > bare short ref), with a title penalty and a resolution bonus. Ambiguous heuristic-resolved refs are capped at 0.60. */
911
941
  confidence?: number | null;
942
+ /** @description 'confirmed' when confidence >= 0.75 and the link is unambiguous (or confirmed via bidirectional evidence); otherwise 'candidate'. Only 'confirmed' links are attributable. */
912
943
  status?: string;
913
- billable?: boolean;
944
+ /** @description True when the linked PR/MR CONTRIBUTED to the issue (status === 'confirmed', any linkKind incl. references and reverse links). This is the flag to use for imputation/billing — preparatory work counts. */
945
+ attributable?: boolean;
946
+ /** @description True when the linked PR/MR actually CLOSES the issue (status === 'confirmed' && linkKind === 'resolution'). Use for issue status, NOT for billing. */
947
+ resolves?: boolean;
948
+ /** @description Audit trail: the matched snippet, the field it was found in, and the offsets — so a human can verify why the link was classified this way. */
914
949
  evidence?: {
915
950
  field: string;
916
951
  text: string;
@@ -1042,10 +1077,17 @@ export interface operations {
1042
1077
  hintSource: string;
1043
1078
  kind: string;
1044
1079
  };
1080
+ /** @description Raw link classification: 'reference' (mention), 'resolution' (closes the issue), or 'reverse_comment' (link discovered from the issue's comments pointing back at this PR/MR). */
1045
1081
  linkKind?: string;
1082
+ /** @description Deterministic correlation confidence in [0,1]. Driven by the form of the evidence (canonical URL > cross-ref > bare short ref), with a title penalty and a resolution bonus. Ambiguous heuristic-resolved refs are capped at 0.60. */
1046
1083
  confidence?: number | null;
1084
+ /** @description 'confirmed' when confidence >= 0.75 and the link is unambiguous (or confirmed via bidirectional evidence); otherwise 'candidate'. Only 'confirmed' links are attributable. */
1047
1085
  status?: string;
1048
- billable?: boolean;
1086
+ /** @description True when the linked PR/MR CONTRIBUTED to the issue (status === 'confirmed', any linkKind incl. references and reverse links). This is the flag to use for imputation/billing — preparatory work counts. */
1087
+ attributable?: boolean;
1088
+ /** @description True when the linked PR/MR actually CLOSES the issue (status === 'confirmed' && linkKind === 'resolution'). Use for issue status, NOT for billing. */
1089
+ resolves?: boolean;
1090
+ /** @description Audit trail: the matched snippet, the field it was found in, and the offsets — so a human can verify why the link was classified this way. */
1049
1091
  evidence?: {
1050
1092
  field: string;
1051
1093
  text: string;
@@ -1201,10 +1243,17 @@ export interface operations {
1201
1243
  hintSource: string;
1202
1244
  kind: string;
1203
1245
  };
1246
+ /** @description Raw link classification: 'reference' (mention), 'resolution' (closes the issue), or 'reverse_comment' (link discovered from the issue's comments pointing back at this PR/MR). */
1204
1247
  linkKind?: string;
1248
+ /** @description Deterministic correlation confidence in [0,1]. Driven by the form of the evidence (canonical URL > cross-ref > bare short ref), with a title penalty and a resolution bonus. Ambiguous heuristic-resolved refs are capped at 0.60. */
1205
1249
  confidence?: number | null;
1250
+ /** @description 'confirmed' when confidence >= 0.75 and the link is unambiguous (or confirmed via bidirectional evidence); otherwise 'candidate'. Only 'confirmed' links are attributable. */
1206
1251
  status?: string;
1207
- billable?: boolean;
1252
+ /** @description True when the linked PR/MR CONTRIBUTED to the issue (status === 'confirmed', any linkKind incl. references and reverse links). This is the flag to use for imputation/billing — preparatory work counts. */
1253
+ attributable?: boolean;
1254
+ /** @description True when the linked PR/MR actually CLOSES the issue (status === 'confirmed' && linkKind === 'resolution'). Use for issue status, NOT for billing. */
1255
+ resolves?: boolean;
1256
+ /** @description Audit trail: the matched snippet, the field it was found in, and the offsets — so a human can verify why the link was classified this way. */
1208
1257
  evidence?: {
1209
1258
  field: string;
1210
1259
  text: string;
@@ -1331,10 +1380,17 @@ export interface operations {
1331
1380
  hintSource: string;
1332
1381
  kind: string;
1333
1382
  };
1383
+ /** @description Raw link classification: 'reference' (mention), 'resolution' (closes the issue), or 'reverse_comment' (link discovered from the issue's comments pointing back at this PR/MR). */
1334
1384
  linkKind?: string;
1385
+ /** @description Deterministic correlation confidence in [0,1]. Driven by the form of the evidence (canonical URL > cross-ref > bare short ref), with a title penalty and a resolution bonus. Ambiguous heuristic-resolved refs are capped at 0.60. */
1335
1386
  confidence?: number | null;
1387
+ /** @description 'confirmed' when confidence >= 0.75 and the link is unambiguous (or confirmed via bidirectional evidence); otherwise 'candidate'. Only 'confirmed' links are attributable. */
1336
1388
  status?: string;
1337
- billable?: boolean;
1389
+ /** @description True when the linked PR/MR CONTRIBUTED to the issue (status === 'confirmed', any linkKind incl. references and reverse links). This is the flag to use for imputation/billing — preparatory work counts. */
1390
+ attributable?: boolean;
1391
+ /** @description True when the linked PR/MR actually CLOSES the issue (status === 'confirmed' && linkKind === 'resolution'). Use for issue status, NOT for billing. */
1392
+ resolves?: boolean;
1393
+ /** @description Audit trail: the matched snippet, the field it was found in, and the offsets — so a human can verify why the link was classified this way. */
1338
1394
  evidence?: {
1339
1395
  field: string;
1340
1396
  text: string;
@@ -1461,10 +1517,17 @@ export interface operations {
1461
1517
  hintSource: string;
1462
1518
  kind: string;
1463
1519
  };
1520
+ /** @description Raw link classification: 'reference' (mention), 'resolution' (closes the issue), or 'reverse_comment' (link discovered from the issue's comments pointing back at this PR/MR). */
1464
1521
  linkKind?: string;
1522
+ /** @description Deterministic correlation confidence in [0,1]. Driven by the form of the evidence (canonical URL > cross-ref > bare short ref), with a title penalty and a resolution bonus. Ambiguous heuristic-resolved refs are capped at 0.60. */
1465
1523
  confidence?: number | null;
1524
+ /** @description 'confirmed' when confidence >= 0.75 and the link is unambiguous (or confirmed via bidirectional evidence); otherwise 'candidate'. Only 'confirmed' links are attributable. */
1466
1525
  status?: string;
1467
- billable?: boolean;
1526
+ /** @description True when the linked PR/MR CONTRIBUTED to the issue (status === 'confirmed', any linkKind incl. references and reverse links). This is the flag to use for imputation/billing — preparatory work counts. */
1527
+ attributable?: boolean;
1528
+ /** @description True when the linked PR/MR actually CLOSES the issue (status === 'confirmed' && linkKind === 'resolution'). Use for issue status, NOT for billing. */
1529
+ resolves?: boolean;
1530
+ /** @description Audit trail: the matched snippet, the field it was found in, and the offsets — so a human can verify why the link was classified this way. */
1468
1531
  evidence?: {
1469
1532
  field: string;
1470
1533
  text: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cesar-richard/git-connector-sdk",
3
- "version": "1.57.0",
3
+ "version": "1.59.0",
4
4
  "description": "TypeScript SDK for the git-connector v1 API (work items + iterations aggregated from GitHub/GitLab). Version published on npm tracks server releases.",
5
5
  "license": "MIT",
6
6
  "repository": {