@oscharko-dev/keiko-contracts 0.2.8 → 0.2.9
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/dist/.tsbuildinfo +1 -1
- package/dist/bff-wire.d.ts +33 -0
- package/dist/bff-wire.d.ts.map +1 -1
- package/dist/command-runner.d.ts +81 -0
- package/dist/command-runner.d.ts.map +1 -0
- package/dist/command-runner.js +209 -0
- package/dist/container-runtime.d.ts +125 -0
- package/dist/container-runtime.d.ts.map +1 -0
- package/dist/container-runtime.js +287 -0
- package/dist/context-engineering.js +2 -2
- package/dist/discussion-intelligence.d.ts +70 -0
- package/dist/discussion-intelligence.d.ts.map +1 -0
- package/dist/discussion-intelligence.js +440 -0
- package/dist/editor-agent-governance.d.ts +65 -0
- package/dist/editor-agent-governance.d.ts.map +1 -0
- package/dist/editor-agent-governance.js +180 -0
- package/dist/editor-agent.d.ts +29 -1
- package/dist/editor-agent.d.ts.map +1 -1
- package/dist/editor-agent.js +183 -6
- package/dist/editor-builtin-capabilities.d.ts +13 -0
- package/dist/editor-builtin-capabilities.d.ts.map +1 -0
- package/dist/editor-builtin-capabilities.js +135 -0
- package/dist/editor-language-mode-map.d.ts +11 -0
- package/dist/editor-language-mode-map.d.ts.map +1 -0
- package/dist/editor-language-mode-map.js +89 -0
- package/dist/editor-layout.d.ts +37 -0
- package/dist/editor-layout.d.ts.map +1 -1
- package/dist/editor-layout.js +125 -8
- package/dist/editor-workspace-path.d.ts +20 -0
- package/dist/editor-workspace-path.d.ts.map +1 -0
- package/dist/editor-workspace-path.js +133 -0
- package/dist/evidence.d.ts +3 -1
- package/dist/evidence.d.ts.map +1 -1
- package/dist/gateway.d.ts +72 -3
- package/dist/gateway.d.ts.map +1 -1
- package/dist/gateway.js +73 -3
- package/dist/git-commit-intent.d.ts +28 -0
- package/dist/git-commit-intent.d.ts.map +1 -0
- package/dist/git-commit-intent.js +155 -0
- package/dist/git-commit-policy.d.ts +29 -0
- package/dist/git-commit-policy.d.ts.map +1 -0
- package/dist/git-commit-policy.js +173 -0
- package/dist/git-delivery-action-sheet.d.ts +157 -0
- package/dist/git-delivery-action-sheet.d.ts.map +1 -0
- package/dist/git-delivery-action-sheet.js +430 -0
- package/dist/git-delivery-evidence.d.ts +92 -0
- package/dist/git-delivery-evidence.d.ts.map +1 -0
- package/dist/git-delivery-evidence.js +272 -0
- package/dist/git-delivery-policy.d.ts +40 -0
- package/dist/git-delivery-policy.d.ts.map +1 -0
- package/dist/git-delivery-policy.js +183 -0
- package/dist/git-delivery-provider.d.ts +53 -0
- package/dist/git-delivery-provider.d.ts.map +1 -0
- package/dist/git-delivery-provider.js +96 -0
- package/dist/git-delivery.d.ts +202 -0
- package/dist/git-delivery.d.ts.map +1 -0
- package/dist/git-delivery.js +410 -0
- package/dist/git-history.d.ts +27 -0
- package/dist/git-history.d.ts.map +1 -0
- package/dist/git-history.js +73 -0
- package/dist/git-merge.d.ts +67 -0
- package/dist/git-merge.d.ts.map +1 -0
- package/dist/git-merge.js +323 -0
- package/dist/git-pull-request.d.ts +112 -0
- package/dist/git-pull-request.d.ts.map +1 -0
- package/dist/git-pull-request.js +351 -0
- package/dist/git-repository-agent.d.ts +46 -0
- package/dist/git-repository-agent.d.ts.map +1 -0
- package/dist/git-repository-agent.js +198 -0
- package/dist/git-repository-summary.d.ts +54 -0
- package/dist/git-repository-summary.d.ts.map +1 -0
- package/dist/git-repository-summary.js +105 -0
- package/dist/git-repository.d.ts +60 -0
- package/dist/git-repository.d.ts.map +1 -0
- package/dist/git-repository.js +106 -0
- package/dist/git-sync.d.ts +49 -0
- package/dist/git-sync.d.ts.map +1 -0
- package/dist/git-sync.js +110 -0
- package/dist/index.d.ts +63 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +33 -6
- package/dist/lsp-process.d.ts +38 -0
- package/dist/lsp-process.d.ts.map +1 -0
- package/dist/lsp-process.js +103 -0
- package/dist/runtime-capabilities.d.ts +44 -0
- package/dist/runtime-capabilities.d.ts.map +1 -0
- package/dist/runtime-capabilities.js +141 -0
- package/dist/task-workspace.d.ts +302 -0
- package/dist/task-workspace.d.ts.map +1 -0
- package/dist/task-workspace.js +1236 -0
- package/dist/voice-action-intent.d.ts +86 -0
- package/dist/voice-action-intent.d.ts.map +1 -0
- package/dist/voice-action-intent.js +387 -0
- package/dist/voice-playback.d.ts +50 -0
- package/dist/voice-playback.d.ts.map +1 -0
- package/dist/voice-playback.js +240 -0
- package/dist/voice-protocol.d.ts +165 -0
- package/dist/voice-protocol.d.ts.map +1 -0
- package/dist/voice-protocol.js +312 -0
- package/dist/voice-transcript.d.ts +57 -0
- package/dist/voice-transcript.d.ts.map +1 -0
- package/dist/voice-transcript.js +221 -0
- package/package.json +5 -1
- package/dist/conversation-budget.d.ts +0 -37
- package/dist/conversation-budget.d.ts.map +0 -1
- package/dist/conversation-budget.js +0 -97
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
// Read-only Git commit history wire contract (Issue #1573, Epic #1572).
|
|
2
|
+
// Pure types + validation helpers only: no filesystem, no process, no clock, no crypto.
|
|
3
|
+
// Reuses GitRepositoryState / GitUnavailableReason / GitRepositoryValidation from git-repository.
|
|
4
|
+
import { GIT_REPOSITORY_STATES } from "./git-repository.js";
|
|
5
|
+
export const GIT_HISTORY_SCHEMA_VERSION = "1";
|
|
6
|
+
function isRecord(input) {
|
|
7
|
+
return typeof input === "object" && input !== null && !Array.isArray(input);
|
|
8
|
+
}
|
|
9
|
+
function isString(input) {
|
|
10
|
+
return typeof input === "string";
|
|
11
|
+
}
|
|
12
|
+
function isBoolean(input) {
|
|
13
|
+
return typeof input === "boolean";
|
|
14
|
+
}
|
|
15
|
+
function isNonNegativeInteger(input) {
|
|
16
|
+
return typeof input === "number" && Number.isInteger(input) && input >= 0;
|
|
17
|
+
}
|
|
18
|
+
function validateRefs(input, reasons, index) {
|
|
19
|
+
if (!Array.isArray(input)) {
|
|
20
|
+
reasons.push(`entries[${String(index)}].refs must be an array`);
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
if (!input.every(isString)) {
|
|
24
|
+
reasons.push(`entries[${String(index)}].refs must contain only strings`);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
function validateEntry(input, reasons, index) {
|
|
28
|
+
if (!isRecord(input)) {
|
|
29
|
+
reasons.push(`entries[${String(index)}] must be an object`);
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
for (const key of ["sha", "shortSha", "subject", "author", "date"]) {
|
|
33
|
+
if (!isString(input[key]))
|
|
34
|
+
reasons.push(`entries[${String(index)}].${key} must be a string`);
|
|
35
|
+
}
|
|
36
|
+
for (const key of ["parentCount", "changedFileCount"]) {
|
|
37
|
+
if (!isNonNegativeInteger(input[key])) {
|
|
38
|
+
reasons.push(`entries[${String(index)}].${key} must be a non-negative integer`);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
validateRefs(input.refs, reasons, index);
|
|
42
|
+
}
|
|
43
|
+
// History is a paginated wire envelope (entries + limit/skip/truncated); centralizing the
|
|
44
|
+
// validator keeps per-field failure messages predictable for tests and callers.
|
|
45
|
+
// eslint-disable-next-line complexity
|
|
46
|
+
export function validateGitHistoryResponse(input) {
|
|
47
|
+
const reasons = [];
|
|
48
|
+
if (!isRecord(input))
|
|
49
|
+
return { ok: false, reasons: ["response must be an object"] };
|
|
50
|
+
if (input.schemaVersion !== GIT_HISTORY_SCHEMA_VERSION)
|
|
51
|
+
reasons.push("schemaVersion invalid");
|
|
52
|
+
if (!isString(input.root))
|
|
53
|
+
reasons.push("root must be a string");
|
|
54
|
+
if (!GIT_REPOSITORY_STATES.includes(input.state)) {
|
|
55
|
+
reasons.push("state invalid");
|
|
56
|
+
}
|
|
57
|
+
if (!isBoolean(input.available))
|
|
58
|
+
reasons.push("available must be a boolean");
|
|
59
|
+
if (!isBoolean(input.truncated))
|
|
60
|
+
reasons.push("truncated must be a boolean");
|
|
61
|
+
if (!isNonNegativeInteger(input.limit))
|
|
62
|
+
reasons.push("limit must be a non-negative integer");
|
|
63
|
+
if (!isNonNegativeInteger(input.skip))
|
|
64
|
+
reasons.push("skip must be a non-negative integer");
|
|
65
|
+
if (!Array.isArray(input.entries))
|
|
66
|
+
reasons.push("entries must be an array");
|
|
67
|
+
else {
|
|
68
|
+
input.entries.forEach((entry, index) => {
|
|
69
|
+
validateEntry(entry, reasons, index);
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
return reasons.length === 0 ? { ok: true } : { ok: false, reasons };
|
|
73
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { GitDeliveryExecutionErrorCode, GitDeliveryMergeBlockReason, GitDeliveryMergeStrategyHint, GitDeliveryParseResult } from "./git-delivery.js";
|
|
2
|
+
import type { GitDeliveryRecoveryActionHint } from "./git-delivery-action-sheet.js";
|
|
3
|
+
import type { GitDeliveryRecoveryDisposition } from "./git-delivery-evidence.js";
|
|
4
|
+
import type { GitDeliveryBranchProtection, GitDeliveryChecksState, GitDeliveryPullRequestState } from "./git-delivery-provider.js";
|
|
5
|
+
export declare const GIT_MERGE_SCHEMA_VERSION: "1";
|
|
6
|
+
export type GitMergeLifecycleBlockerCode = "pr-not-open" | "pr-already-merged" | "draft-pr" | "strategy-unavailable" | "readiness-unknown" | "provider-error";
|
|
7
|
+
export declare const GIT_MERGE_LIFECYCLE_BLOCKER_CODES: readonly GitMergeLifecycleBlockerCode[];
|
|
8
|
+
export type GitMergeReadinessBlockerCode = GitDeliveryMergeBlockReason | GitMergeLifecycleBlockerCode;
|
|
9
|
+
export declare const GIT_MERGE_READINESS_BLOCKER_CODES: readonly GitMergeReadinessBlockerCode[];
|
|
10
|
+
export type GitMergeBlockerSeverity = "blocking" | "advisory";
|
|
11
|
+
export type GitMergeRemediationClass = "user-actionable" | "internal";
|
|
12
|
+
export interface GitMergeReadinessBlocker {
|
|
13
|
+
readonly code: GitMergeReadinessBlockerCode;
|
|
14
|
+
readonly severity: GitMergeBlockerSeverity;
|
|
15
|
+
readonly remediation: GitMergeRemediationClass;
|
|
16
|
+
}
|
|
17
|
+
export interface GitMergeReadinessSummary {
|
|
18
|
+
readonly schemaVersion: typeof GIT_MERGE_SCHEMA_VERSION;
|
|
19
|
+
readonly mergeable: boolean;
|
|
20
|
+
readonly blockers: readonly GitMergeReadinessBlocker[];
|
|
21
|
+
}
|
|
22
|
+
export declare function gitMergeBlockerRemediationFor(code: GitMergeReadinessBlockerCode): GitMergeRemediationClass;
|
|
23
|
+
export declare function gitMergeBlockerActionHintFor(code: GitMergeReadinessBlockerCode): GitDeliveryRecoveryActionHint | undefined;
|
|
24
|
+
export interface GitMergeStrategyPolicy {
|
|
25
|
+
readonly allowedStrategies: readonly GitDeliveryMergeStrategyHint[];
|
|
26
|
+
}
|
|
27
|
+
export interface GitMergeStrategyEligibility {
|
|
28
|
+
readonly eligible: readonly GitDeliveryMergeStrategyHint[];
|
|
29
|
+
readonly selectedDefault: GitDeliveryMergeStrategyHint | undefined;
|
|
30
|
+
readonly requestedEligible: boolean;
|
|
31
|
+
}
|
|
32
|
+
export declare function deriveEligibleMergeStrategies(requested: GitDeliveryMergeStrategyHint, policy: GitMergeStrategyPolicy, providerCapable: readonly GitDeliveryMergeStrategyHint[]): GitMergeStrategyEligibility;
|
|
33
|
+
export type GitMergeRecommendation = "merge-allowed" | "needs-approval" | "blocked" | "already-merged";
|
|
34
|
+
export declare const GIT_MERGE_RECOMMENDATIONS: readonly GitMergeRecommendation[];
|
|
35
|
+
export interface GitMergeApprovalContext {
|
|
36
|
+
readonly requiresApproval: boolean;
|
|
37
|
+
readonly approvalSatisfied: boolean;
|
|
38
|
+
}
|
|
39
|
+
export declare function gitMergeRecommendationFor(readiness: GitMergeReadinessSummary, approval: GitMergeApprovalContext): GitMergeRecommendation;
|
|
40
|
+
export type GitMergeRejectionReason = "not-mergeable" | "checks-failing" | "approvals-missing" | "conflict" | "head-modified" | "strategy-unavailable" | "branch-protection" | "already-merged" | "not-found" | "permission-denied" | "rate-limited" | "provider-unavailable" | "unknown";
|
|
41
|
+
export declare const GIT_MERGE_REJECTION_REASONS: readonly GitMergeRejectionReason[];
|
|
42
|
+
export declare const GIT_MERGE_REJECTION_ERROR_CODE: Readonly<Record<GitMergeRejectionReason, GitDeliveryExecutionErrorCode>>;
|
|
43
|
+
export declare const GIT_MERGE_REJECTION_DISPOSITION: Readonly<Record<GitMergeRejectionReason, GitDeliveryRecoveryDisposition>>;
|
|
44
|
+
export declare function gitMergeRejectionToErrorCode(reason: GitMergeRejectionReason): GitDeliveryExecutionErrorCode;
|
|
45
|
+
export declare function gitMergeRejectionToDisposition(reason: GitMergeRejectionReason): GitDeliveryRecoveryDisposition;
|
|
46
|
+
export interface GitMergeRejection {
|
|
47
|
+
readonly reason: GitMergeRejectionReason;
|
|
48
|
+
readonly disposition: GitDeliveryRecoveryDisposition;
|
|
49
|
+
readonly actionHint?: GitDeliveryRecoveryActionHint | undefined;
|
|
50
|
+
}
|
|
51
|
+
export declare function gitMergeRejectionFor(reason: GitMergeRejectionReason): GitMergeRejection;
|
|
52
|
+
export declare const isGitMergeReadinessBlockerCode: (v: unknown) => v is GitMergeReadinessBlockerCode;
|
|
53
|
+
export declare const isGitMergeRecommendation: (v: unknown) => v is GitMergeRecommendation;
|
|
54
|
+
export declare const isGitMergeRejectionReason: (v: unknown) => v is GitMergeRejectionReason;
|
|
55
|
+
export interface GitMergeReadinessInput {
|
|
56
|
+
readonly pullRequest?: GitDeliveryPullRequestState | undefined;
|
|
57
|
+
readonly checks?: GitDeliveryChecksState | undefined;
|
|
58
|
+
readonly branchProtection?: GitDeliveryBranchProtection | undefined;
|
|
59
|
+
readonly strategyEligible?: boolean | undefined;
|
|
60
|
+
readonly providerError?: boolean | undefined;
|
|
61
|
+
}
|
|
62
|
+
export declare function gitMergeReadinessFor(input: GitMergeReadinessInput): GitMergeReadinessSummary;
|
|
63
|
+
export declare function gitMergeReadinessBlockerIsPrerequisite(code: GitMergeReadinessBlockerCode): boolean;
|
|
64
|
+
export declare function isGitMergeReadinessBlocker(value: unknown): value is GitMergeReadinessBlocker;
|
|
65
|
+
export declare function isGitMergeReadinessSummary(value: unknown): value is GitMergeReadinessSummary;
|
|
66
|
+
export declare function parseGitMergeReadinessSummary(value: unknown): GitDeliveryParseResult<GitMergeReadinessSummary>;
|
|
67
|
+
//# sourceMappingURL=git-merge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git-merge.d.ts","sourceRoot":"","sources":["../src/git-merge.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EACV,6BAA6B,EAC7B,2BAA2B,EAC3B,4BAA4B,EAC5B,sBAAsB,EACvB,MAAM,mBAAmB,CAAC;AAK3B,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,gCAAgC,CAAC;AACpF,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,4BAA4B,CAAC;AACjF,OAAO,KAAK,EACV,2BAA2B,EAC3B,sBAAsB,EACtB,2BAA2B,EAC5B,MAAM,4BAA4B,CAAC;AAGpC,eAAO,MAAM,wBAAwB,EAAG,GAAY,CAAC;AASrD,MAAM,MAAM,4BAA4B,GACpC,aAAa,GACb,mBAAmB,GACnB,UAAU,GACV,sBAAsB,GACtB,mBAAmB,GACnB,gBAAgB,CAAC;AAErB,eAAO,MAAM,iCAAiC,EAAE,SAAS,4BAA4B,EAO3E,CAAC;AAEX,MAAM,MAAM,4BAA4B,GACpC,2BAA2B,GAC3B,4BAA4B,CAAC;AAEjC,eAAO,MAAM,iCAAiC,EAAE,SAAS,4BAA4B,EAG3E,CAAC;AAEX,MAAM,MAAM,uBAAuB,GAAG,UAAU,GAAG,UAAU,CAAC;AAC9D,MAAM,MAAM,wBAAwB,GAAG,iBAAiB,GAAG,UAAU,CAAC;AAEtE,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,IAAI,EAAE,4BAA4B,CAAC;IAC5C,QAAQ,CAAC,QAAQ,EAAE,uBAAuB,CAAC;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AAC;IAGpE,QAAQ,CAAC,gBAAgB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAEhD,QAAQ,CAAC,aAAa,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CAC9C;AAqGD,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,sBAAsB,GAAG,wBAAwB,CAQ5F;AAID,wBAAgB,sCAAsC,CACpD,IAAI,EAAE,4BAA4B,GACjC,OAAO,CAET;AAID,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,wBAAwB,CAO5F;AAMD,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,wBAAwB,CAO5F;AAID,wBAAgB,6BAA6B,CAC3C,KAAK,EAAE,OAAO,GACb,sBAAsB,CAAC,wBAAwB,CAAC,CAKlD"}
|
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
// Governed merge orchestration contracts (Issue #478, Epic #470; ADR-0065). Ownership: the
|
|
2
|
+
// provider-neutral, content-free merge-governance leaf — the merge-readiness model, the strategy
|
|
3
|
+
// eligibility derivation, the merge recommendation, and the provider-failure rejection taxonomy. It is
|
|
4
|
+
// the merge counterpart of git-pull-request.ts (the PR-orchestration leaf) and sits on top of the
|
|
5
|
+
// existing merge action kind, merge inputs, merge strategy hints, the merge block-reason taxonomy, the
|
|
6
|
+
// provider-state interfaces, the execution-error codes, and the recovery vocabulary.
|
|
7
|
+
//
|
|
8
|
+
// Disjoint from git-delivery.ts (the action/risk model), git-delivery-provider.ts (provider-neutral
|
|
9
|
+
// state), git-delivery-evidence.ts (the audit record), git-delivery-action-sheet.ts (the approval
|
|
10
|
+
// surface), and git-pull-request.ts (the PR leaf). The GitHub-specific transport, the mergeable-state
|
|
11
|
+
// mapper, and the raw-error classifier are keiko-tools concerns; this leaf never imports a kernel type
|
|
12
|
+
// and never carries raw provider content.
|
|
13
|
+
//
|
|
14
|
+
// Leaf-package rules (ADR-0019, ADR-0058, ADR-0065): pure types, frozen const tables, and pure
|
|
15
|
+
// functions only. No IO, no clock, no crypto, no randomness, no provider field names. Relative imports
|
|
16
|
+
// end in ".js" and reference only sibling git-delivery*.ts leaves.
|
|
17
|
+
//
|
|
18
|
+
// Content-free by construction: a merge carries no user-authored free content. Its readiness is derived
|
|
19
|
+
// from counts, typed enums, and booleans (the provider-state interfaces), never from raw diffs, commit
|
|
20
|
+
// bodies, or provider error envelopes.
|
|
21
|
+
import { GIT_DELIVERY_MERGE_BLOCK_REASONS, GIT_DELIVERY_MERGE_STRATEGY_HINTS, } from "./git-delivery.js";
|
|
22
|
+
// Pinned schema version. A breaking change adds a NEW literal member; this one is never mutated.
|
|
23
|
+
export const GIT_MERGE_SCHEMA_VERSION = "1";
|
|
24
|
+
export const GIT_MERGE_LIFECYCLE_BLOCKER_CODES = [
|
|
25
|
+
"pr-not-open",
|
|
26
|
+
"pr-already-merged",
|
|
27
|
+
"draft-pr",
|
|
28
|
+
"strategy-unavailable",
|
|
29
|
+
"readiness-unknown",
|
|
30
|
+
"provider-error",
|
|
31
|
+
];
|
|
32
|
+
export const GIT_MERGE_READINESS_BLOCKER_CODES = [
|
|
33
|
+
...GIT_DELIVERY_MERGE_BLOCK_REASONS,
|
|
34
|
+
...GIT_MERGE_LIFECYCLE_BLOCKER_CODES,
|
|
35
|
+
];
|
|
36
|
+
// Frozen, exhaustive code → remediation table. Keyed on every code so a new code forces an explicit
|
|
37
|
+
// classification here (the Record is not Partial).
|
|
38
|
+
const MERGE_BLOCKER_REMEDIATION = {
|
|
39
|
+
"checks-failing": "user-actionable",
|
|
40
|
+
"approvals-missing": "user-actionable",
|
|
41
|
+
conflicts: "user-actionable",
|
|
42
|
+
"branch-protection": "user-actionable",
|
|
43
|
+
"merge-queue-position": "user-actionable",
|
|
44
|
+
"provider-policy": "internal",
|
|
45
|
+
"pr-not-open": "user-actionable",
|
|
46
|
+
"pr-already-merged": "user-actionable",
|
|
47
|
+
"draft-pr": "user-actionable",
|
|
48
|
+
"strategy-unavailable": "user-actionable",
|
|
49
|
+
"readiness-unknown": "internal",
|
|
50
|
+
"provider-error": "internal",
|
|
51
|
+
};
|
|
52
|
+
export function gitMergeBlockerRemediationFor(code) {
|
|
53
|
+
return MERGE_BLOCKER_REMEDIATION[code];
|
|
54
|
+
}
|
|
55
|
+
// ─── Recovery action hints (reused #473 vocabulary) ───────────────────────────────────────────────────
|
|
56
|
+
// Hints only where the vocabulary fits cleanly; a blocker with no clean hint carries none rather than a
|
|
57
|
+
// misleading one. The precise blocker code remains the primary user-facing signal.
|
|
58
|
+
const MERGE_BLOCKER_ACTION_HINT = {
|
|
59
|
+
"checks-failing": "wait-for-provider",
|
|
60
|
+
"approvals-missing": "request-approval",
|
|
61
|
+
conflicts: "resolve-conflicts",
|
|
62
|
+
"branch-protection": "adjust-policy-target",
|
|
63
|
+
"merge-queue-position": "wait-for-provider",
|
|
64
|
+
"provider-policy": "adjust-policy-target",
|
|
65
|
+
"pr-not-open": undefined,
|
|
66
|
+
"pr-already-merged": undefined,
|
|
67
|
+
"draft-pr": undefined,
|
|
68
|
+
"strategy-unavailable": "recover-via-strategy",
|
|
69
|
+
"readiness-unknown": "wait-for-provider",
|
|
70
|
+
"provider-error": "wait-for-provider",
|
|
71
|
+
};
|
|
72
|
+
export function gitMergeBlockerActionHintFor(code) {
|
|
73
|
+
return MERGE_BLOCKER_ACTION_HINT[code];
|
|
74
|
+
}
|
|
75
|
+
// "provider-default" defers strategy choice to the provider; it is eligible iff policy permits it AND at
|
|
76
|
+
// least one CONCRETE strategy is eligible (so the provider has something to default to). Concrete
|
|
77
|
+
// strategies are eligible iff both policy and provider allow them.
|
|
78
|
+
export function deriveEligibleMergeStrategies(requested, policy, providerCapable) {
|
|
79
|
+
const policySet = new Set(policy.allowedStrategies);
|
|
80
|
+
const providerSet = new Set(providerCapable);
|
|
81
|
+
const concrete = GIT_DELIVERY_MERGE_STRATEGY_HINTS.filter((s) => s !== "provider-default" && policySet.has(s) && providerSet.has(s));
|
|
82
|
+
const providerDefaultEligible = policySet.has("provider-default") && concrete.length > 0;
|
|
83
|
+
const eligible = [...concrete];
|
|
84
|
+
if (providerDefaultEligible) {
|
|
85
|
+
eligible.push("provider-default");
|
|
86
|
+
}
|
|
87
|
+
const requestedEligible = eligible.includes(requested);
|
|
88
|
+
const selectedDefault = requestedEligible ? requested : eligible[0];
|
|
89
|
+
return {
|
|
90
|
+
eligible,
|
|
91
|
+
...(selectedDefault !== undefined ? { selectedDefault } : { selectedDefault: undefined }),
|
|
92
|
+
requestedEligible,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
export const GIT_MERGE_RECOMMENDATIONS = [
|
|
96
|
+
"merge-allowed",
|
|
97
|
+
"needs-approval",
|
|
98
|
+
"blocked",
|
|
99
|
+
"already-merged",
|
|
100
|
+
];
|
|
101
|
+
export function gitMergeRecommendationFor(readiness, approval) {
|
|
102
|
+
if (readiness.blockers.some((b) => b.code === "pr-already-merged")) {
|
|
103
|
+
return "already-merged";
|
|
104
|
+
}
|
|
105
|
+
if (readiness.blockers.some((b) => b.severity === "blocking")) {
|
|
106
|
+
return "blocked";
|
|
107
|
+
}
|
|
108
|
+
if (approval.requiresApproval && !approval.approvalSatisfied) {
|
|
109
|
+
return "needs-approval";
|
|
110
|
+
}
|
|
111
|
+
return "merge-allowed";
|
|
112
|
+
}
|
|
113
|
+
export const GIT_MERGE_REJECTION_REASONS = [
|
|
114
|
+
"not-mergeable",
|
|
115
|
+
"checks-failing",
|
|
116
|
+
"approvals-missing",
|
|
117
|
+
"conflict",
|
|
118
|
+
"head-modified",
|
|
119
|
+
"strategy-unavailable",
|
|
120
|
+
"branch-protection",
|
|
121
|
+
"already-merged",
|
|
122
|
+
"not-found",
|
|
123
|
+
"permission-denied",
|
|
124
|
+
"rate-limited",
|
|
125
|
+
"provider-unavailable",
|
|
126
|
+
"unknown",
|
|
127
|
+
];
|
|
128
|
+
// Exhaustive reason → content-free execution error code (recorded in evidence). Total Record (not
|
|
129
|
+
// Partial): a new reason is a compile error here rather than a silent gap.
|
|
130
|
+
export const GIT_MERGE_REJECTION_ERROR_CODE = {
|
|
131
|
+
"not-mergeable": "precondition-failed",
|
|
132
|
+
"checks-failing": "precondition-failed",
|
|
133
|
+
"approvals-missing": "precondition-failed",
|
|
134
|
+
conflict: "conflict",
|
|
135
|
+
"head-modified": "precondition-failed",
|
|
136
|
+
"strategy-unavailable": "provider-rejected",
|
|
137
|
+
"branch-protection": "provider-rejected",
|
|
138
|
+
"already-merged": "precondition-failed",
|
|
139
|
+
"not-found": "provider-rejected",
|
|
140
|
+
"permission-denied": "provider-rejected",
|
|
141
|
+
"rate-limited": "network-failure",
|
|
142
|
+
"provider-unavailable": "network-failure",
|
|
143
|
+
unknown: "provider-rejected",
|
|
144
|
+
};
|
|
145
|
+
// Exhaustive reason → three-way recovery disposition (reused #474 vocabulary).
|
|
146
|
+
export const GIT_MERGE_REJECTION_DISPOSITION = {
|
|
147
|
+
"not-mergeable": "user-fixable",
|
|
148
|
+
"checks-failing": "user-fixable",
|
|
149
|
+
"approvals-missing": "user-fixable",
|
|
150
|
+
conflict: "user-fixable",
|
|
151
|
+
"head-modified": "retryable",
|
|
152
|
+
"strategy-unavailable": "user-fixable",
|
|
153
|
+
"branch-protection": "policy-forbidden",
|
|
154
|
+
"already-merged": "none",
|
|
155
|
+
"not-found": "user-fixable",
|
|
156
|
+
"permission-denied": "policy-forbidden",
|
|
157
|
+
"rate-limited": "retryable",
|
|
158
|
+
"provider-unavailable": "retryable",
|
|
159
|
+
unknown: "user-fixable",
|
|
160
|
+
};
|
|
161
|
+
// Reason → recovery action hint, where the vocabulary fits cleanly (else none).
|
|
162
|
+
const MERGE_REJECTION_ACTION_HINT = {
|
|
163
|
+
"not-mergeable": undefined,
|
|
164
|
+
"checks-failing": "wait-for-provider",
|
|
165
|
+
"approvals-missing": "request-approval",
|
|
166
|
+
conflict: "resolve-conflicts",
|
|
167
|
+
"head-modified": "retry",
|
|
168
|
+
"strategy-unavailable": "recover-via-strategy",
|
|
169
|
+
"branch-protection": "adjust-policy-target",
|
|
170
|
+
"already-merged": undefined,
|
|
171
|
+
"not-found": undefined,
|
|
172
|
+
"permission-denied": undefined,
|
|
173
|
+
"rate-limited": "wait-for-provider",
|
|
174
|
+
"provider-unavailable": "wait-for-provider",
|
|
175
|
+
unknown: undefined,
|
|
176
|
+
};
|
|
177
|
+
export function gitMergeRejectionToErrorCode(reason) {
|
|
178
|
+
return GIT_MERGE_REJECTION_ERROR_CODE[reason];
|
|
179
|
+
}
|
|
180
|
+
export function gitMergeRejectionToDisposition(reason) {
|
|
181
|
+
return GIT_MERGE_REJECTION_DISPOSITION[reason];
|
|
182
|
+
}
|
|
183
|
+
export function gitMergeRejectionFor(reason) {
|
|
184
|
+
const actionHint = MERGE_REJECTION_ACTION_HINT[reason];
|
|
185
|
+
return {
|
|
186
|
+
reason,
|
|
187
|
+
disposition: gitMergeRejectionToDisposition(reason),
|
|
188
|
+
...(actionHint !== undefined ? { actionHint } : {}),
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
// ─── Private predicate helpers ──────────────────────────────────────────────────────────────────────
|
|
192
|
+
function isString(value) {
|
|
193
|
+
return typeof value === "string";
|
|
194
|
+
}
|
|
195
|
+
function isBoolean(value) {
|
|
196
|
+
return typeof value === "boolean";
|
|
197
|
+
}
|
|
198
|
+
function isRecord(value) {
|
|
199
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
200
|
+
}
|
|
201
|
+
function isInSet(set) {
|
|
202
|
+
return (v) => isString(v) && set.includes(v);
|
|
203
|
+
}
|
|
204
|
+
// ─── Exported enum guards ─────────────────────────────────────────────────────────────────────────
|
|
205
|
+
export const isGitMergeReadinessBlockerCode = isInSet(GIT_MERGE_READINESS_BLOCKER_CODES);
|
|
206
|
+
export const isGitMergeRecommendation = isInSet(GIT_MERGE_RECOMMENDATIONS);
|
|
207
|
+
export const isGitMergeRejectionReason = isInSet(GIT_MERGE_REJECTION_REASONS);
|
|
208
|
+
function blocking(code) {
|
|
209
|
+
return { code, severity: "blocking", remediation: gitMergeBlockerRemediationFor(code) };
|
|
210
|
+
}
|
|
211
|
+
function advisory(code) {
|
|
212
|
+
return { code, severity: "advisory", remediation: gitMergeBlockerRemediationFor(code) };
|
|
213
|
+
}
|
|
214
|
+
const MERGE_PREREQ_CODES = new Set(GIT_DELIVERY_MERGE_BLOCK_REASONS);
|
|
215
|
+
// The provider merge-readiness signal plus the approval/check enrichment, in deterministic order.
|
|
216
|
+
// Duplicates (a blockingReason that coincides with the approvals/checks derivation) are removed by the
|
|
217
|
+
// caller's dedupeByCode, so no `.includes` guards are needed here.
|
|
218
|
+
function mergePrerequisiteCodes(mr, checksFailing) {
|
|
219
|
+
const codes = [];
|
|
220
|
+
if (!mr.ready && mr.blockingReason !== undefined) {
|
|
221
|
+
codes.push(mr.blockingReason);
|
|
222
|
+
}
|
|
223
|
+
if (mr.receivedApprovalCount < mr.requiredApprovalCount) {
|
|
224
|
+
codes.push("approvals-missing");
|
|
225
|
+
}
|
|
226
|
+
if (!mr.ready && checksFailing) {
|
|
227
|
+
codes.push("checks-failing");
|
|
228
|
+
}
|
|
229
|
+
return codes;
|
|
230
|
+
}
|
|
231
|
+
// Merge-prerequisite blocker codes for an OPEN PR, in deterministic order. Draft and strategy come
|
|
232
|
+
// first (preview-time facts), then the provider merge-readiness signal, then the readiness-unknown
|
|
233
|
+
// fallback when not ready and nothing concrete was surfaced.
|
|
234
|
+
function collectOpenPrBlockerCodes(pr, input) {
|
|
235
|
+
const codes = [];
|
|
236
|
+
if (pr.isDraft) {
|
|
237
|
+
codes.push("draft-pr");
|
|
238
|
+
}
|
|
239
|
+
if (input.strategyEligible === false) {
|
|
240
|
+
codes.push("strategy-unavailable");
|
|
241
|
+
}
|
|
242
|
+
codes.push(...mergePrerequisiteCodes(pr.mergeReadiness, input.checks?.overallStatus === "failing"));
|
|
243
|
+
if (!pr.mergeReadiness.ready && codes.length === 0) {
|
|
244
|
+
codes.push("readiness-unknown");
|
|
245
|
+
}
|
|
246
|
+
return codes;
|
|
247
|
+
}
|
|
248
|
+
function collectMergeBlocking(input) {
|
|
249
|
+
if (input.providerError === true) {
|
|
250
|
+
return [blocking("provider-error")];
|
|
251
|
+
}
|
|
252
|
+
const pr = input.pullRequest;
|
|
253
|
+
if (pr === undefined) {
|
|
254
|
+
return [blocking("readiness-unknown")];
|
|
255
|
+
}
|
|
256
|
+
if (pr.status === "merged") {
|
|
257
|
+
return [blocking("pr-already-merged")];
|
|
258
|
+
}
|
|
259
|
+
if (pr.status === "closed") {
|
|
260
|
+
return [blocking("pr-not-open")];
|
|
261
|
+
}
|
|
262
|
+
return dedupeByCode(collectOpenPrBlockerCodes(pr, input)).map(blocking);
|
|
263
|
+
}
|
|
264
|
+
function collectMergeAdvisory(input) {
|
|
265
|
+
const pr = input.pullRequest;
|
|
266
|
+
// A provider-mergeable PR whose non-required checks are failing (e.g. an "unstable" state): merge is
|
|
267
|
+
// permitted, but the failing checks are worth surfacing as an advisory.
|
|
268
|
+
if (pr?.status === "open" &&
|
|
269
|
+
!pr.isDraft &&
|
|
270
|
+
pr.mergeReadiness.ready &&
|
|
271
|
+
input.checks?.overallStatus === "failing") {
|
|
272
|
+
return [advisory("checks-failing")];
|
|
273
|
+
}
|
|
274
|
+
return [];
|
|
275
|
+
}
|
|
276
|
+
function dedupeByCode(codes) {
|
|
277
|
+
const seen = new Set();
|
|
278
|
+
const out = [];
|
|
279
|
+
for (const code of codes) {
|
|
280
|
+
if (!seen.has(code)) {
|
|
281
|
+
seen.add(code);
|
|
282
|
+
out.push(code);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
return out;
|
|
286
|
+
}
|
|
287
|
+
export function gitMergeReadinessFor(input) {
|
|
288
|
+
const blockingBlockers = collectMergeBlocking(input);
|
|
289
|
+
const advisoryBlockers = collectMergeAdvisory(input);
|
|
290
|
+
return {
|
|
291
|
+
schemaVersion: GIT_MERGE_SCHEMA_VERSION,
|
|
292
|
+
mergeable: blockingBlockers.length === 0,
|
|
293
|
+
blockers: [...blockingBlockers, ...advisoryBlockers],
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
// `MERGE_PREREQ_CODES` is exported indirectly through gitMergeReadinessBlockerIsPrerequisite so callers
|
|
297
|
+
// can tell a merge-prerequisite blocker (the #471 taxonomy) from a lifecycle/preview blocker.
|
|
298
|
+
export function gitMergeReadinessBlockerIsPrerequisite(code) {
|
|
299
|
+
return MERGE_PREREQ_CODES.has(code);
|
|
300
|
+
}
|
|
301
|
+
// ─── Structural guards ──────────────────────────────────────────────────────────────────────────────
|
|
302
|
+
export function isGitMergeReadinessBlocker(value) {
|
|
303
|
+
return (isRecord(value) &&
|
|
304
|
+
isGitMergeReadinessBlockerCode(value.code) &&
|
|
305
|
+
(value.severity === "blocking" || value.severity === "advisory") &&
|
|
306
|
+
(value.remediation === "user-actionable" || value.remediation === "internal"));
|
|
307
|
+
}
|
|
308
|
+
function isBlockerArray(value) {
|
|
309
|
+
return Array.isArray(value) && value.every(isGitMergeReadinessBlocker);
|
|
310
|
+
}
|
|
311
|
+
export function isGitMergeReadinessSummary(value) {
|
|
312
|
+
return (isRecord(value) &&
|
|
313
|
+
value.schemaVersion === GIT_MERGE_SCHEMA_VERSION &&
|
|
314
|
+
isBoolean(value.mergeable) &&
|
|
315
|
+
isBlockerArray(value.blockers));
|
|
316
|
+
}
|
|
317
|
+
// ─── Parse ──────────────────────────────────────────────────────────────────────────────────────────
|
|
318
|
+
export function parseGitMergeReadinessSummary(value) {
|
|
319
|
+
if (!isGitMergeReadinessSummary(value)) {
|
|
320
|
+
return { ok: false, errors: ["value is not a valid GitMergeReadinessSummary"] };
|
|
321
|
+
}
|
|
322
|
+
return { ok: true, value };
|
|
323
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import type { GitDeliveryExecutionErrorCode, GitDeliveryParseResult, GitDeliveryRiskClass } from "./git-delivery.js";
|
|
2
|
+
import type { GitDeliveryRecoveryDisposition } from "./git-delivery-evidence.js";
|
|
3
|
+
import type { GitDeliveryChecksState, GitDeliveryMergeReadiness, GitDeliveryPullRequestState } from "./git-delivery-provider.js";
|
|
4
|
+
export declare const GIT_PULL_REQUEST_SCHEMA_VERSION: "1";
|
|
5
|
+
export type GitPrChangeType = "feat" | "fix" | "refactor" | "docs" | "chore" | "test" | "mixed";
|
|
6
|
+
export declare const GIT_PR_CHANGE_TYPES: readonly GitPrChangeType[];
|
|
7
|
+
export interface GitPullRequestChangeNarrative {
|
|
8
|
+
readonly commitCount: number;
|
|
9
|
+
readonly fileCount: number;
|
|
10
|
+
readonly areaCount: number;
|
|
11
|
+
readonly areas: readonly string[];
|
|
12
|
+
readonly touchesTests: boolean;
|
|
13
|
+
readonly changeType: GitPrChangeType;
|
|
14
|
+
}
|
|
15
|
+
export type GitPrPolicyOutcome = "allowed" | "blocked" | "approval-gated" | "constrained";
|
|
16
|
+
export declare const GIT_PR_POLICY_OUTCOMES: readonly GitPrPolicyOutcome[];
|
|
17
|
+
export interface GitPullRequestRiskDigest {
|
|
18
|
+
readonly riskClass: GitDeliveryRiskClass;
|
|
19
|
+
readonly riskSeverity: number;
|
|
20
|
+
readonly policyOutcome: GitPrPolicyOutcome;
|
|
21
|
+
readonly isDraft: boolean;
|
|
22
|
+
}
|
|
23
|
+
export interface GitPrSummarySection {
|
|
24
|
+
readonly changeType: GitPrChangeType;
|
|
25
|
+
readonly commitCount: number;
|
|
26
|
+
readonly fileCount: number;
|
|
27
|
+
readonly areaCount: number;
|
|
28
|
+
readonly primaryArea?: string | undefined;
|
|
29
|
+
}
|
|
30
|
+
export interface GitPrRiskSection {
|
|
31
|
+
readonly riskClass: GitDeliveryRiskClass;
|
|
32
|
+
readonly policyOutcome: GitPrPolicyOutcome;
|
|
33
|
+
readonly requiresApproval: boolean;
|
|
34
|
+
}
|
|
35
|
+
export interface GitPrChangeNarrativeSection {
|
|
36
|
+
readonly touchesTests: boolean;
|
|
37
|
+
readonly areas: readonly string[];
|
|
38
|
+
readonly changeType: GitPrChangeType;
|
|
39
|
+
}
|
|
40
|
+
export interface GitPullRequestMetadataDraft {
|
|
41
|
+
readonly schemaVersion: typeof GIT_PULL_REQUEST_SCHEMA_VERSION;
|
|
42
|
+
readonly composedTitle: string;
|
|
43
|
+
readonly summarySection: GitPrSummarySection;
|
|
44
|
+
readonly riskSection: GitPrRiskSection;
|
|
45
|
+
readonly changeNarrativeSection: GitPrChangeNarrativeSection;
|
|
46
|
+
readonly riskNarrative: string;
|
|
47
|
+
}
|
|
48
|
+
export type GitPullRequestReadinessBlockerCode = "head-unpublished" | "base-missing" | "head-equals-base" | "draft-pr" | "required-checks-failing" | "checks-pending" | "approval-insufficient" | "merge-conflict" | "provider-error";
|
|
49
|
+
export declare const GIT_PR_READINESS_BLOCKER_CODES: readonly GitPullRequestReadinessBlockerCode[];
|
|
50
|
+
export type GitPrBlockerSeverity = "blocking" | "advisory";
|
|
51
|
+
export type GitPrRemediationClass = "user-actionable" | "internal";
|
|
52
|
+
export interface GitPullRequestReadinessBlocker {
|
|
53
|
+
readonly code: GitPullRequestReadinessBlockerCode;
|
|
54
|
+
readonly severity: GitPrBlockerSeverity;
|
|
55
|
+
readonly remediation: GitPrRemediationClass;
|
|
56
|
+
}
|
|
57
|
+
export interface GitPullRequestReadinessSummary {
|
|
58
|
+
readonly schemaVersion: typeof GIT_PULL_REQUEST_SCHEMA_VERSION;
|
|
59
|
+
readonly objectExists: boolean;
|
|
60
|
+
readonly reviewReady: boolean;
|
|
61
|
+
readonly blockers: readonly GitPullRequestReadinessBlocker[];
|
|
62
|
+
}
|
|
63
|
+
export type GitPullRequestRecommendation = "create-as-draft" | "create-as-ready" | "update-to-ready" | "keep-as-draft" | "blocked";
|
|
64
|
+
export declare const GIT_PR_RECOMMENDATIONS: readonly GitPullRequestRecommendation[];
|
|
65
|
+
export type GitPrReviewerSuggestionBasis = "area-ownership" | "none";
|
|
66
|
+
export type GitPrLabelSuggestionBasis = "change-type" | "area" | "none";
|
|
67
|
+
export type GitPrLinkageSuggestionBasis = "branch-name" | "none";
|
|
68
|
+
export interface GitPullRequestReviewerSuggestion {
|
|
69
|
+
readonly suggestedReviewerIds: readonly string[];
|
|
70
|
+
readonly basis: GitPrReviewerSuggestionBasis;
|
|
71
|
+
}
|
|
72
|
+
export interface GitPullRequestLabelSuggestion {
|
|
73
|
+
readonly suggestedLabelNames: readonly string[];
|
|
74
|
+
readonly basis: GitPrLabelSuggestionBasis;
|
|
75
|
+
}
|
|
76
|
+
export interface GitPullRequestLinkageSuggestion {
|
|
77
|
+
readonly suggestedIssueRefs: readonly string[];
|
|
78
|
+
readonly basis: GitPrLinkageSuggestionBasis;
|
|
79
|
+
}
|
|
80
|
+
export type GitPullRequestRejectionReason = "already-exists" | "base-missing" | "head-unpublished" | "validation-error" | "permission-denied" | "not-found" | "rate-limited" | "provider-unavailable" | "unknown";
|
|
81
|
+
export declare const GIT_PR_REJECTION_REASONS: readonly GitPullRequestRejectionReason[];
|
|
82
|
+
export declare const GIT_PR_REJECTION_ERROR_CODE: Readonly<Record<GitPullRequestRejectionReason, GitDeliveryExecutionErrorCode>>;
|
|
83
|
+
export declare const GIT_PR_REJECTION_DISPOSITION: Readonly<Record<GitPullRequestRejectionReason, GitDeliveryRecoveryDisposition>>;
|
|
84
|
+
export declare function gitPrRejectionToErrorCode(reason: GitPullRequestRejectionReason): GitDeliveryExecutionErrorCode;
|
|
85
|
+
export declare function gitPrRejectionToDisposition(reason: GitPullRequestRejectionReason): GitDeliveryRecoveryDisposition;
|
|
86
|
+
export declare const isGitPrChangeType: (v: unknown) => v is GitPrChangeType;
|
|
87
|
+
export declare const isGitPrPolicyOutcome: (v: unknown) => v is GitPrPolicyOutcome;
|
|
88
|
+
export declare const isGitPullRequestReadinessBlockerCode: (v: unknown) => v is GitPullRequestReadinessBlockerCode;
|
|
89
|
+
export declare const isGitPullRequestRecommendation: (v: unknown) => v is GitPullRequestRecommendation;
|
|
90
|
+
export declare const isGitPullRequestRejectionReason: (v: unknown) => v is GitPullRequestRejectionReason;
|
|
91
|
+
export declare function synthesizePullRequestMetadata(narrative: GitPullRequestChangeNarrative, riskDigest: GitPullRequestRiskDigest, headBranch: string, _baseBranch: string): GitPullRequestMetadataDraft;
|
|
92
|
+
export interface GitPullRequestReadinessInput {
|
|
93
|
+
readonly headBranchName: string;
|
|
94
|
+
readonly baseBranchName: string;
|
|
95
|
+
readonly headPublished: boolean;
|
|
96
|
+
readonly baseExists: boolean;
|
|
97
|
+
readonly pullRequest?: GitDeliveryPullRequestState | undefined;
|
|
98
|
+
readonly checks?: GitDeliveryChecksState | undefined;
|
|
99
|
+
readonly mergeReadiness?: GitDeliveryMergeReadiness | undefined;
|
|
100
|
+
readonly providerError?: boolean | undefined;
|
|
101
|
+
}
|
|
102
|
+
export declare function gitPullRequestReadinessFor(input: GitPullRequestReadinessInput): GitPullRequestReadinessSummary;
|
|
103
|
+
export declare function gitPullRequestRecommendationFor(readiness: GitPullRequestReadinessSummary, riskDigest: GitPullRequestRiskDigest): GitPullRequestRecommendation;
|
|
104
|
+
export declare function gitPullRequestReviewerSuggestionsFor(narrative: GitPullRequestChangeNarrative, areaOwners?: Readonly<Record<string, readonly string[]>>): GitPullRequestReviewerSuggestion;
|
|
105
|
+
export declare function gitPullRequestLabelSuggestionsFor(narrative: GitPullRequestChangeNarrative): GitPullRequestLabelSuggestion;
|
|
106
|
+
export declare function gitPullRequestLinkageSuggestionsFor(headBranch: string): GitPullRequestLinkageSuggestion;
|
|
107
|
+
export declare function isGitPullRequestReadinessBlocker(value: unknown): value is GitPullRequestReadinessBlocker;
|
|
108
|
+
export declare function isGitPullRequestReadinessSummary(value: unknown): value is GitPullRequestReadinessSummary;
|
|
109
|
+
export declare function isGitPullRequestChangeNarrative(value: unknown): value is GitPullRequestChangeNarrative;
|
|
110
|
+
export declare function isGitPullRequestMetadataDraft(value: unknown): value is GitPullRequestMetadataDraft;
|
|
111
|
+
export declare function parseGitPullRequestReadinessSummary(value: unknown): GitDeliveryParseResult<GitPullRequestReadinessSummary>;
|
|
112
|
+
//# sourceMappingURL=git-pull-request.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git-pull-request.d.ts","sourceRoot":"","sources":["../src/git-pull-request.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EACV,6BAA6B,EAC7B,sBAAsB,EACtB,oBAAoB,EACrB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,4BAA4B,CAAC;AACjF,OAAO,KAAK,EACV,sBAAsB,EACtB,yBAAyB,EACzB,2BAA2B,EAC5B,MAAM,4BAA4B,CAAC;AAGpC,eAAO,MAAM,+BAA+B,EAAG,GAAY,CAAC;AAI5D,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,KAAK,GAAG,UAAU,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC;AAEhG,eAAO,MAAM,mBAAmB,EAAE,SAAS,eAAe,EAQhD,CAAC;AAMX,MAAM,WAAW,6BAA6B;IAC5C,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;IAC/B,QAAQ,CAAC,UAAU,EAAE,eAAe,CAAC;CACtC;AAED,MAAM,MAAM,kBAAkB,GAAG,SAAS,GAAG,SAAS,GAAG,gBAAgB,GAAG,aAAa,CAAC;AAE1F,eAAO,MAAM,sBAAsB,EAAE,SAAS,kBAAkB,EAKtD,CAAC;AAEX,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,SAAS,EAAE,oBAAoB,CAAC;IACzC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ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