@gitkraken/conflict-tools 0.2.4-beta.2 → 0.2.4-beta.3
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/CHANGELOG.md
CHANGED
|
@@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/).
|
|
|
11
11
|
|
|
12
12
|
- Reference-integrity detection. `resolveConflicts` now attaches a `StepResult.detection` report listing broken references (symbols that resolved in a pre-merge parent but no longer resolve in the merged result, with provenance), duplicate definitions, and syntax errors in the resolved files. Detection is opt-in via a new `ParserPort` (`ResolverDeps.parser`) that supplies parsing/symbol resolution per surface (tree-sitter, language server); when it is absent, unavailable, or a file's language is unsupported, the report says so rather than implying a clean result. Report-only in this release — no automatic fixing.
|
|
13
13
|
- Auto-merged scope for reference-integrity detection: the detector discovers the merge's incoming/auto-merged set itself (new optional `changedFiles` git-port op; `git diff --name-only base..theirs`, base from `refs.base` or `mergeBase`) and includes it in scope, so dangling references in cleanly-merged files are caught. Scope is capped and reported via `DetectionReport.scope`; an optional `ResolutionContext.touchedFiles` overrides discovery. Adds a `dropped-side` finding when a whole-side take (take-ours/take-theirs/fallback) discards a substantial diff from the other side.
|
|
14
|
+
- Operation-level assessment: `buildOperationDigest`/`summarizeOperation` now fold `StepResult.detection` into the rollup. A file with an error-severity finding (broken-reference, dropped-side, syntax-error, duplicate-definition) is added to `needsReview` (`reason: 'finding'`) regardless of confidence — even a file with no resolution of its own; `OperationDigest.detectionComplete` reports whether every detection check ran (so empty findings on a skipped check are not read as clean); and a derived `OperationDigest.verdict` (`'clean' | 'needs-review' | 'blocked'`) gives consumers an honest gate signal. `ReviewItem` gains `reason` and optional `findingCategories`, and its `confidence` is now optional.
|
|
14
15
|
|
|
15
16
|
## [0.2.3] - 2026-07-06
|
|
16
17
|
|
package/dist/index.d.ts
CHANGED
|
@@ -20,6 +20,6 @@ import { ConflictProgressEvent } from "./types/events.js";
|
|
|
20
20
|
import { resolveConflict } from "./resolver/resolve-conflict.js";
|
|
21
21
|
import { FileRule, StepConfig, StepResult } from "./types/step.js";
|
|
22
22
|
import { resolveConflicts } from "./resolver/resolve-conflicts.js";
|
|
23
|
-
import { OperationDigest, OperationSummary, ReviewItem } from "./types/summary.js";
|
|
23
|
+
import { OperationDigest, OperationSummary, OperationVerdict, ReviewItem } from "./types/summary.js";
|
|
24
24
|
import { SummarizeOperationOptions, buildOperationDigest, summarizeOperation } from "./resolver/summarize-operation.js";
|
|
25
|
-
export { AIError, type AIErrorCode, type BlameOptions, type CheckStatus, type Conflict, type ConflictDiffOptions, ConflictError, type ConflictErrorCode, type ConflictGitOps, type ConflictGitPort, ConflictGitPortMissingOpError, type ConflictMarker, type ConflictMarkerUserInput, type ConflictModelMessage, type ConflictModelParams, type ConflictModelPort, type ConflictModelResult, type ConflictProgressEvent, type ConflictType, type DetectDeps, type DetectionReport, type DiffStats, type FileRule, type Finding, type FindingCategory, type FindingTier, type GrepOptions, type IntraFileEditOp, type Issue, type LogOptions, type OpOptions, type OperationDigest, type OperationSummary, type ParsedFile, type ParserPort, type Resolution, type ResolutionContext, type ResolutionMetrics, type ResolutionRawSignals, type ResolutionRefs, type ResolutionStrategy, type ResolutionVerifier, type ResolvedChunk, type ResolverConfig, type ReviewItem, type ShowFileOptions, type ShowOptions, type SourceOverlay, type StepConfig, type StepResult, type SummarizeOperationOptions, type SymbolDefinition, type SymbolReference, type SyntaxIssue, type ThreeWayDiff, type ToolCall, type ToolDefinition, type ToolResult, type UnmergedEntry, type UnmergedReason, type VerificationResult, applyResolutions, buildOperationDigest, checkoutFile, createResolution, defaultVerifier, detect, extractConflict, removeFile, resolveConflict, resolveConflicts, show, summarizeOperation, takeOurs, takeTheirs };
|
|
25
|
+
export { AIError, type AIErrorCode, type BlameOptions, type CheckStatus, type Conflict, type ConflictDiffOptions, ConflictError, type ConflictErrorCode, type ConflictGitOps, type ConflictGitPort, ConflictGitPortMissingOpError, type ConflictMarker, type ConflictMarkerUserInput, type ConflictModelMessage, type ConflictModelParams, type ConflictModelPort, type ConflictModelResult, type ConflictProgressEvent, type ConflictType, type DetectDeps, type DetectionReport, type DiffStats, type FileRule, type Finding, type FindingCategory, type FindingTier, type GrepOptions, type IntraFileEditOp, type Issue, type LogOptions, type OpOptions, type OperationDigest, type OperationSummary, type OperationVerdict, type ParsedFile, type ParserPort, type Resolution, type ResolutionContext, type ResolutionMetrics, type ResolutionRawSignals, type ResolutionRefs, type ResolutionStrategy, type ResolutionVerifier, type ResolvedChunk, type ResolverConfig, type ReviewItem, type ShowFileOptions, type ShowOptions, type SourceOverlay, type StepConfig, type StepResult, type SummarizeOperationOptions, type SymbolDefinition, type SymbolReference, type SyntaxIssue, type ThreeWayDiff, type ToolCall, type ToolDefinition, type ToolResult, type UnmergedEntry, type UnmergedReason, type VerificationResult, applyResolutions, buildOperationDigest, checkoutFile, createResolution, defaultVerifier, detect, extractConflict, removeFile, resolveConflict, resolveConflicts, show, summarizeOperation, takeOurs, takeTheirs };
|
|
@@ -16,7 +16,8 @@ interface SummarizeOperationOptions {
|
|
|
16
16
|
reviewThreshold?: number;
|
|
17
17
|
temperature?: number;
|
|
18
18
|
}
|
|
19
|
-
/** Pure, model-free rollup of a {@link StepResult}
|
|
19
|
+
/** Pure, model-free rollup of a {@link StepResult}, folding in `detection` so a file with an error
|
|
20
|
+
* finding — or a detection check that did not run — can never read as clean. */
|
|
20
21
|
declare function buildOperationDigest(result: StepResult, reviewThreshold?: number): OperationDigest;
|
|
21
22
|
/**
|
|
22
23
|
* Summarize a resolve operation for a reviewer. Always returns a deterministic `digest`; when
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{buildSummaryPrompt as e}from"./prompt.js";const t=.8;function n(e,n=t){let
|
|
1
|
+
import{buildSummaryPrompt as e}from"./prompt.js";const t=.8;function n(e,n=t){let a={ai:0,"take-ours":0,"take-theirs":0,deleted:0,skipped:0},o=0,s=null,c=new Map;for(let t of e.resolutions)a[t.strategy]++,o+=t.chunks?.length??0,s=s===null?t.confidence:Math.min(s,t.confidence),t.confidence<n&&c.set(t.filePath,{filePath:t.filePath,confidence:t.confidence,reason:`low-confidence`});let l=e.detection,u=l?.findings??[],d=new Map;for(let e of u){if(e.severity!==`error`)continue;let t=d.get(e.location.file)??new Set;t.add(e.category),d.set(e.location.file,t)}for(let[e,t]of d){let n=c.get(e);c.set(e,{filePath:e,...n?.confidence==null?{}:{confidence:n.confidence},reason:`finding`,findingCategories:[...t].sort()})}let f=[...c.values()].sort(r),p=l!=null&&l.checks.referenceIntegrity===`ran`&&l.checks.structural===`ran`,m=i({hasErrorFinding:d.size>0,hasWarningFinding:u.some(e=>e.severity===`warning`),needsReview:f.length>0,detectionComplete:p,hasErrors:e.errors.length>0});return{files:e.resolutions.length,conflicts:o,byStrategy:a,minConfidence:s,needsReview:f,skipped:e.skipped?.length??0,errors:e.errors.length,detectionComplete:p,findingCount:u.length,verdict:m}}function r(e,t){return e.reason===t.reason?(e.confidence??1)-(t.confidence??1):e.reason===`finding`?-1:1}function i(e){return e.hasErrorFinding?`blocked`:e.needsReview||!e.detectionComplete||e.hasErrors||e.hasWarningFinding?`needs-review`:`clean`}async function a(r,i={}){let a=n(r,i.reviewThreshold??t);if(!i.model)return{digest:a};let{system:o,userMessage:s}=e(r,a),c=await i.model.generate({system:o,messages:[{role:`user`,content:s}],temperature:i.temperature??0,signal:i.signal}),l=c.text?.trim();return{digest:a,...l?{prose:l}:{},...c.usage?{usage:c.usage}:{}}}export{n as buildOperationDigest,a as summarizeOperation};
|
package/dist/types/summary.d.ts
CHANGED
|
@@ -1,12 +1,23 @@
|
|
|
1
1
|
import { ResolutionStrategy } from "./resolution.js";
|
|
2
|
+
import { FindingCategory } from "./findings.js";
|
|
2
3
|
import { AiTokenUsage } from "@gitkraken/shared-tools";
|
|
3
4
|
|
|
4
5
|
//#region src/types/summary.d.ts
|
|
5
|
-
/** A
|
|
6
|
+
/** A file flagged for human review. `reason` distinguishes a low file-confidence flag from a
|
|
7
|
+
* detection finding; `confidence` is absent for files flagged purely by a finding (e.g. an
|
|
8
|
+
* auto-merged file with no resolution of its own). */
|
|
6
9
|
interface ReviewItem {
|
|
7
10
|
filePath: string;
|
|
8
|
-
confidence
|
|
11
|
+
confidence?: number;
|
|
12
|
+
reason: 'low-confidence' | 'finding';
|
|
13
|
+
/** Categories of the error-severity findings on this file; present when `reason` is `'finding'`. */
|
|
14
|
+
findingCategories?: FindingCategory[];
|
|
9
15
|
}
|
|
16
|
+
/** Suggested honest verdict for the operation. `blocked` when any error-severity finding exists;
|
|
17
|
+
* `needs-review` when confidence is low, detection did not fully run, resolution errored, or a
|
|
18
|
+
* warning finding exists; `clean` only when none of those apply. Advisory — the consumer owns its
|
|
19
|
+
* own gate, but this must not read as clean when the build is known-broken. */
|
|
20
|
+
type OperationVerdict = 'clean' | 'needs-review' | 'blocked';
|
|
10
21
|
/** Deterministic, model-free rollup of a resolve operation. */
|
|
11
22
|
interface OperationDigest {
|
|
12
23
|
/** Files that produced a resolution. */
|
|
@@ -17,12 +28,21 @@ interface OperationDigest {
|
|
|
17
28
|
byStrategy: Record<ResolutionStrategy, number>;
|
|
18
29
|
/** Lowest file confidence across all resolutions; null when there are none. */
|
|
19
30
|
minConfidence: number | null;
|
|
20
|
-
/**
|
|
31
|
+
/** Files needing review — low-confidence resolutions and files with error findings, findings
|
|
32
|
+
* first, then lowest confidence first. */
|
|
21
33
|
needsReview: ReviewItem[];
|
|
22
34
|
/** Files skipped by rule or because they had no markers. */
|
|
23
35
|
skipped: number;
|
|
24
36
|
/** Files that errored during resolution. */
|
|
25
37
|
errors: number;
|
|
38
|
+
/** Whether reference-integrity detection ran to completion (every check `ran`). `false` when no
|
|
39
|
+
* detection was attached or any check was skipped/errored — so empty findings must NOT be read
|
|
40
|
+
* as "clean". */
|
|
41
|
+
detectionComplete: boolean;
|
|
42
|
+
/** Total detection findings across the operation. */
|
|
43
|
+
findingCount: number;
|
|
44
|
+
/** Suggested honest verdict; see {@link OperationVerdict}. */
|
|
45
|
+
verdict: OperationVerdict;
|
|
26
46
|
}
|
|
27
47
|
/** Result of summarizing an operation: always a digest, plus a narrative when a model was provided. */
|
|
28
48
|
interface OperationSummary {
|
|
@@ -33,4 +53,4 @@ interface OperationSummary {
|
|
|
33
53
|
usage?: AiTokenUsage;
|
|
34
54
|
}
|
|
35
55
|
//#endregion
|
|
36
|
-
export { OperationDigest, OperationSummary, ReviewItem };
|
|
56
|
+
export { OperationDigest, OperationSummary, OperationVerdict, ReviewItem };
|