@oscharko-dev/keiko-contracts 0.2.7 → 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 +86 -19
- 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/prompt-enhancer-analyzer.d.ts.map +1 -1
- package/dist/prompt-enhancer-analyzer.js +198 -22
- 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,351 @@
|
|
|
1
|
+
// Governed GitHub pull request orchestration contracts (Issue #477, Epic #470; ADR-0064). Ownership:
|
|
2
|
+
// the provider-neutral, content-free PR-orchestration leaf — the readiness model, the deterministic
|
|
3
|
+
// metadata-synthesis heuristics, the reviewer/label/linkage suggestion shapes, and the provider-failure
|
|
4
|
+
// rejection taxonomy. It is the PR counterpart of git-commit-intent.ts (deterministic composition) and
|
|
5
|
+
// git-delivery-action-sheet.ts (content-free projection), and it sits on top of the existing PR input
|
|
6
|
+
// shapes, provider-state interfaces, execution-error codes, and recovery-disposition 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), and git-delivery-action-sheet.ts (the approval
|
|
10
|
+
// surface). The GitHub-specific transport, the raw-error classifier, and the actual PR title/body
|
|
11
|
+
// strings are keiko-tools concerns; this leaf never imports a kernel type and never carries raw content.
|
|
12
|
+
//
|
|
13
|
+
// Leaf-package rules (ADR-0019, ADR-0058, ADR-0064): pure types, frozen const tables, and pure
|
|
14
|
+
// functions only. No IO, no clock, no crypto, no randomness, no provider field names. Relative imports
|
|
15
|
+
// end in ".js" and reference only sibling git-delivery*.ts leaves.
|
|
16
|
+
//
|
|
17
|
+
// Content-free by construction: the synthesizer's INPUTS are counts, coarse area tokens, typed enums,
|
|
18
|
+
// and branch names — never raw diff content, file paths, or commit message bodies. The composed
|
|
19
|
+
// title/body DRAFT it returns is user-editable and is NEVER persisted to evidence (evidence carries only
|
|
20
|
+
// the titleByteLength / bodyByteLength already defined on the GitDeliveryPr*Inputs).
|
|
21
|
+
// Pinned schema version. A breaking change adds a NEW literal member; this one is never mutated.
|
|
22
|
+
export const GIT_PULL_REQUEST_SCHEMA_VERSION = "1";
|
|
23
|
+
export const GIT_PR_CHANGE_TYPES = [
|
|
24
|
+
"feat",
|
|
25
|
+
"fix",
|
|
26
|
+
"refactor",
|
|
27
|
+
"docs",
|
|
28
|
+
"chore",
|
|
29
|
+
"test",
|
|
30
|
+
"mixed",
|
|
31
|
+
];
|
|
32
|
+
export const GIT_PR_POLICY_OUTCOMES = [
|
|
33
|
+
"allowed",
|
|
34
|
+
"blocked",
|
|
35
|
+
"approval-gated",
|
|
36
|
+
"constrained",
|
|
37
|
+
];
|
|
38
|
+
export const GIT_PR_READINESS_BLOCKER_CODES = [
|
|
39
|
+
"head-unpublished",
|
|
40
|
+
"base-missing",
|
|
41
|
+
"head-equals-base",
|
|
42
|
+
"draft-pr",
|
|
43
|
+
"required-checks-failing",
|
|
44
|
+
"checks-pending",
|
|
45
|
+
"approval-insufficient",
|
|
46
|
+
"merge-conflict",
|
|
47
|
+
"provider-error",
|
|
48
|
+
];
|
|
49
|
+
export const GIT_PR_RECOMMENDATIONS = [
|
|
50
|
+
"create-as-draft",
|
|
51
|
+
"create-as-ready",
|
|
52
|
+
"update-to-ready",
|
|
53
|
+
"keep-as-draft",
|
|
54
|
+
"blocked",
|
|
55
|
+
];
|
|
56
|
+
export const GIT_PR_REJECTION_REASONS = [
|
|
57
|
+
"already-exists",
|
|
58
|
+
"base-missing",
|
|
59
|
+
"head-unpublished",
|
|
60
|
+
"validation-error",
|
|
61
|
+
"permission-denied",
|
|
62
|
+
"not-found",
|
|
63
|
+
"rate-limited",
|
|
64
|
+
"provider-unavailable",
|
|
65
|
+
"unknown",
|
|
66
|
+
];
|
|
67
|
+
// Exhaustive reason → content-free execution error code (recorded in evidence). Total Record (not
|
|
68
|
+
// Partial): a new reason is a compile error here rather than a silent gap.
|
|
69
|
+
export const GIT_PR_REJECTION_ERROR_CODE = {
|
|
70
|
+
"already-exists": "precondition-failed",
|
|
71
|
+
"base-missing": "precondition-failed",
|
|
72
|
+
"head-unpublished": "precondition-failed",
|
|
73
|
+
"validation-error": "provider-rejected",
|
|
74
|
+
"permission-denied": "provider-rejected",
|
|
75
|
+
"not-found": "provider-rejected",
|
|
76
|
+
"rate-limited": "network-failure",
|
|
77
|
+
"provider-unavailable": "network-failure",
|
|
78
|
+
unknown: "provider-rejected",
|
|
79
|
+
};
|
|
80
|
+
// Exhaustive reason → three-way recovery disposition (reused #474 vocabulary).
|
|
81
|
+
export const GIT_PR_REJECTION_DISPOSITION = {
|
|
82
|
+
"already-exists": "user-fixable",
|
|
83
|
+
"base-missing": "user-fixable",
|
|
84
|
+
"head-unpublished": "user-fixable",
|
|
85
|
+
"validation-error": "user-fixable",
|
|
86
|
+
"permission-denied": "user-fixable",
|
|
87
|
+
"not-found": "user-fixable",
|
|
88
|
+
"rate-limited": "retryable",
|
|
89
|
+
"provider-unavailable": "retryable",
|
|
90
|
+
unknown: "user-fixable",
|
|
91
|
+
};
|
|
92
|
+
export function gitPrRejectionToErrorCode(reason) {
|
|
93
|
+
return GIT_PR_REJECTION_ERROR_CODE[reason];
|
|
94
|
+
}
|
|
95
|
+
export function gitPrRejectionToDisposition(reason) {
|
|
96
|
+
return GIT_PR_REJECTION_DISPOSITION[reason];
|
|
97
|
+
}
|
|
98
|
+
// ─── Private predicate helpers ──────────────────────────────────────────────────────────────────────
|
|
99
|
+
function isString(value) {
|
|
100
|
+
return typeof value === "string";
|
|
101
|
+
}
|
|
102
|
+
function isBoolean(value) {
|
|
103
|
+
return typeof value === "boolean";
|
|
104
|
+
}
|
|
105
|
+
function isNonNegativeInteger(value) {
|
|
106
|
+
return typeof value === "number" && Number.isInteger(value) && value >= 0;
|
|
107
|
+
}
|
|
108
|
+
function isRecord(value) {
|
|
109
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
110
|
+
}
|
|
111
|
+
function isInSet(set) {
|
|
112
|
+
return (v) => isString(v) && set.includes(v);
|
|
113
|
+
}
|
|
114
|
+
// ─── Exported enum guards ─────────────────────────────────────────────────────────────────────────
|
|
115
|
+
export const isGitPrChangeType = isInSet(GIT_PR_CHANGE_TYPES);
|
|
116
|
+
export const isGitPrPolicyOutcome = isInSet(GIT_PR_POLICY_OUTCOMES);
|
|
117
|
+
export const isGitPullRequestReadinessBlockerCode = isInSet(GIT_PR_READINESS_BLOCKER_CODES);
|
|
118
|
+
export const isGitPullRequestRecommendation = isInSet(GIT_PR_RECOMMENDATIONS);
|
|
119
|
+
export const isGitPullRequestRejectionReason = isInSet(GIT_PR_REJECTION_REASONS);
|
|
120
|
+
// ─── Metadata synthesis (PURE, deterministic) ───────────────────────────────────────────────────────
|
|
121
|
+
// Title = `type(scope): <humanised head-branch slug>`, clamped to ≤ 72 code units. The slug strips the
|
|
122
|
+
// branch namespace prefix and a leading `issue-<n>` token, then turns dashes into spaces. All inputs are
|
|
123
|
+
// counts, enums, area tokens, and branch names — no raw content.
|
|
124
|
+
const TITLE_MAX = 72;
|
|
125
|
+
function primaryAreaOf(narrative) {
|
|
126
|
+
const first = narrative.areas[0];
|
|
127
|
+
return narrative.areaCount === 1 && first !== undefined && first.length > 0 ? first : undefined;
|
|
128
|
+
}
|
|
129
|
+
function humaniseBranchSlug(headBranch) {
|
|
130
|
+
const segments = headBranch.split("/");
|
|
131
|
+
const tail = segments[segments.length - 1] ?? headBranch;
|
|
132
|
+
const tokens = tail.split("-").filter((t) => t.length > 0);
|
|
133
|
+
// Drop a leading run of `issue` markers and pure-numeric issue numbers (e.g. "issue-477-…",
|
|
134
|
+
// "1234-…"), keeping only the descriptive remainder of the slug.
|
|
135
|
+
let start = 0;
|
|
136
|
+
while (start < tokens.length) {
|
|
137
|
+
const token = (tokens[start] ?? "").toLowerCase();
|
|
138
|
+
if (token === "issue" || /^[0-9]+$/.test(token)) {
|
|
139
|
+
start += 1;
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
break;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
return tokens.slice(start).join(" ").trim();
|
|
146
|
+
}
|
|
147
|
+
function clampTitle(title) {
|
|
148
|
+
return title.length <= TITLE_MAX ? title : title.slice(0, TITLE_MAX).trimEnd();
|
|
149
|
+
}
|
|
150
|
+
function composeTitle(narrative, headBranch) {
|
|
151
|
+
const scope = primaryAreaOf(narrative);
|
|
152
|
+
const prefix = scope !== undefined ? `${narrative.changeType}(${scope})` : narrative.changeType;
|
|
153
|
+
const slug = humaniseBranchSlug(headBranch);
|
|
154
|
+
const clause = slug.length > 0 ? slug : `update ${String(narrative.fileCount)} file(s)`;
|
|
155
|
+
return clampTitle(`${prefix}: ${clause}`);
|
|
156
|
+
}
|
|
157
|
+
function composeRiskNarrative(narrative, riskDigest) {
|
|
158
|
+
const testClause = narrative.touchesTests ? ", including test changes" : "";
|
|
159
|
+
return (`This change is classified ${riskDigest.riskClass} (severity ${String(riskDigest.riskSeverity)}); ` +
|
|
160
|
+
`policy outcome ${riskDigest.policyOutcome}. It spans ${String(narrative.fileCount)} file(s) across ` +
|
|
161
|
+
`${String(narrative.areaCount)} area(s) over ${String(narrative.commitCount)} commit(s)${testClause}.`);
|
|
162
|
+
}
|
|
163
|
+
export function synthesizePullRequestMetadata(narrative, riskDigest, headBranch, _baseBranch) {
|
|
164
|
+
const primaryArea = primaryAreaOf(narrative);
|
|
165
|
+
const summarySection = {
|
|
166
|
+
changeType: narrative.changeType,
|
|
167
|
+
commitCount: narrative.commitCount,
|
|
168
|
+
fileCount: narrative.fileCount,
|
|
169
|
+
areaCount: narrative.areaCount,
|
|
170
|
+
...(primaryArea !== undefined ? { primaryArea } : {}),
|
|
171
|
+
};
|
|
172
|
+
return {
|
|
173
|
+
schemaVersion: GIT_PULL_REQUEST_SCHEMA_VERSION,
|
|
174
|
+
composedTitle: composeTitle(narrative, headBranch),
|
|
175
|
+
summarySection,
|
|
176
|
+
riskSection: {
|
|
177
|
+
riskClass: riskDigest.riskClass,
|
|
178
|
+
policyOutcome: riskDigest.policyOutcome,
|
|
179
|
+
requiresApproval: riskDigest.policyOutcome === "approval-gated",
|
|
180
|
+
},
|
|
181
|
+
changeNarrativeSection: {
|
|
182
|
+
touchesTests: narrative.touchesTests,
|
|
183
|
+
areas: narrative.areas,
|
|
184
|
+
changeType: narrative.changeType,
|
|
185
|
+
},
|
|
186
|
+
riskNarrative: composeRiskNarrative(narrative, riskDigest),
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
function blocking(code) {
|
|
190
|
+
return { code, severity: "blocking", remediation: "user-actionable" };
|
|
191
|
+
}
|
|
192
|
+
function advisory(code, remediation) {
|
|
193
|
+
return { code, severity: "advisory", remediation };
|
|
194
|
+
}
|
|
195
|
+
function collectBlockingBlockers(input) {
|
|
196
|
+
const out = [];
|
|
197
|
+
if (input.headBranchName === input.baseBranchName) {
|
|
198
|
+
out.push(blocking("head-equals-base"));
|
|
199
|
+
}
|
|
200
|
+
if (!input.headPublished) {
|
|
201
|
+
out.push(blocking("head-unpublished"));
|
|
202
|
+
}
|
|
203
|
+
if (!input.baseExists) {
|
|
204
|
+
out.push(blocking("base-missing"));
|
|
205
|
+
}
|
|
206
|
+
if (input.checks?.overallStatus === "failing") {
|
|
207
|
+
out.push(blocking("required-checks-failing"));
|
|
208
|
+
}
|
|
209
|
+
if (input.mergeReadiness?.blockingReason === "conflicts") {
|
|
210
|
+
out.push(blocking("merge-conflict"));
|
|
211
|
+
}
|
|
212
|
+
if (input.providerError === true) {
|
|
213
|
+
out.push({ code: "provider-error", severity: "blocking", remediation: "internal" });
|
|
214
|
+
}
|
|
215
|
+
return out;
|
|
216
|
+
}
|
|
217
|
+
function collectAdvisoryBlockers(input) {
|
|
218
|
+
const out = [];
|
|
219
|
+
if (input.pullRequest?.isDraft === true) {
|
|
220
|
+
out.push(advisory("draft-pr", "user-actionable"));
|
|
221
|
+
}
|
|
222
|
+
if (input.checks?.overallStatus === "pending") {
|
|
223
|
+
out.push(advisory("checks-pending", "internal"));
|
|
224
|
+
}
|
|
225
|
+
if (input.mergeReadiness?.blockingReason === "approvals-missing") {
|
|
226
|
+
out.push(advisory("approval-insufficient", "user-actionable"));
|
|
227
|
+
}
|
|
228
|
+
return out;
|
|
229
|
+
}
|
|
230
|
+
export function gitPullRequestReadinessFor(input) {
|
|
231
|
+
const blockingBlockers = collectBlockingBlockers(input);
|
|
232
|
+
const advisoryBlockers = collectAdvisoryBlockers(input);
|
|
233
|
+
const blockers = [...blockingBlockers, ...advisoryBlockers];
|
|
234
|
+
const objectExists = input.pullRequest !== undefined;
|
|
235
|
+
const isDraft = input.pullRequest?.isDraft === true;
|
|
236
|
+
const reviewReady = objectExists && !isDraft && blockingBlockers.length === 0;
|
|
237
|
+
return {
|
|
238
|
+
schemaVersion: GIT_PULL_REQUEST_SCHEMA_VERSION,
|
|
239
|
+
objectExists,
|
|
240
|
+
reviewReady,
|
|
241
|
+
blockers,
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
// ─── Recommendation derivation (PURE) ───────────────────────────────────────────────────────────────
|
|
245
|
+
export function gitPullRequestRecommendationFor(readiness, riskDigest) {
|
|
246
|
+
const hasBlocking = readiness.blockers.some((b) => b.severity === "blocking");
|
|
247
|
+
if (hasBlocking) {
|
|
248
|
+
return "blocked";
|
|
249
|
+
}
|
|
250
|
+
if (!readiness.objectExists) {
|
|
251
|
+
return riskDigest.isDraft ? "create-as-draft" : "create-as-ready";
|
|
252
|
+
}
|
|
253
|
+
// The PR exists and has no blocking blockers. Advisory blockers (pending checks, missing approvals)
|
|
254
|
+
// counsel keeping it as a draft; a clean PR is recommended for the move to ready-for-review.
|
|
255
|
+
return readiness.blockers.length > 0 ? "keep-as-draft" : "update-to-ready";
|
|
256
|
+
}
|
|
257
|
+
// ─── Suggestion derivations (PURE, deterministic) ───────────────────────────────────────────────────
|
|
258
|
+
const LABEL_BY_CHANGE_TYPE = {
|
|
259
|
+
feat: "enhancement",
|
|
260
|
+
fix: "bug",
|
|
261
|
+
refactor: "refactor",
|
|
262
|
+
docs: "documentation",
|
|
263
|
+
chore: "chore",
|
|
264
|
+
test: "test",
|
|
265
|
+
mixed: "enhancement",
|
|
266
|
+
};
|
|
267
|
+
// Optional area→owners map (e.g. derived server-side from CODEOWNERS). Absent ⇒ no reviewer derivation.
|
|
268
|
+
export function gitPullRequestReviewerSuggestionsFor(narrative, areaOwners) {
|
|
269
|
+
if (areaOwners === undefined) {
|
|
270
|
+
return { suggestedReviewerIds: [], basis: "none" };
|
|
271
|
+
}
|
|
272
|
+
const ids = new Set();
|
|
273
|
+
for (const area of narrative.areas) {
|
|
274
|
+
for (const owner of areaOwners[area] ?? []) {
|
|
275
|
+
ids.add(owner);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
return ids.size > 0
|
|
279
|
+
? { suggestedReviewerIds: [...ids], basis: "area-ownership" }
|
|
280
|
+
: { suggestedReviewerIds: [], basis: "none" };
|
|
281
|
+
}
|
|
282
|
+
export function gitPullRequestLabelSuggestionsFor(narrative) {
|
|
283
|
+
const labels = new Set();
|
|
284
|
+
labels.add(LABEL_BY_CHANGE_TYPE[narrative.changeType]);
|
|
285
|
+
for (const area of narrative.areas) {
|
|
286
|
+
if (area.length > 0) {
|
|
287
|
+
labels.add(`area:${area}`);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
return { suggestedLabelNames: [...labels], basis: "change-type" };
|
|
291
|
+
}
|
|
292
|
+
// Extracts issue-ref tokens from the head branch name only (e.g. "claude/issue-477-..." → "#477",
|
|
293
|
+
// "fix/1234-..." → "#1234"). Deterministic; never scans commit bodies in this leaf.
|
|
294
|
+
const BRANCH_ISSUE_RE = /(?:issue[-/])?(\d{1,7})/gi;
|
|
295
|
+
export function gitPullRequestLinkageSuggestionsFor(headBranch) {
|
|
296
|
+
const refs = new Set();
|
|
297
|
+
for (const match of headBranch.matchAll(BRANCH_ISSUE_RE)) {
|
|
298
|
+
const digits = match[1];
|
|
299
|
+
if (digits !== undefined) {
|
|
300
|
+
refs.add(`#${digits}`);
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
return refs.size > 0
|
|
304
|
+
? { suggestedIssueRefs: [...refs], basis: "branch-name" }
|
|
305
|
+
: { suggestedIssueRefs: [], basis: "none" };
|
|
306
|
+
}
|
|
307
|
+
// ─── Structural guards ──────────────────────────────────────────────────────────────────────────────
|
|
308
|
+
export function isGitPullRequestReadinessBlocker(value) {
|
|
309
|
+
return (isRecord(value) &&
|
|
310
|
+
isGitPullRequestReadinessBlockerCode(value.code) &&
|
|
311
|
+
(value.severity === "blocking" || value.severity === "advisory") &&
|
|
312
|
+
(value.remediation === "user-actionable" || value.remediation === "internal"));
|
|
313
|
+
}
|
|
314
|
+
function isBlockerArray(value) {
|
|
315
|
+
return Array.isArray(value) && value.every(isGitPullRequestReadinessBlocker);
|
|
316
|
+
}
|
|
317
|
+
export function isGitPullRequestReadinessSummary(value) {
|
|
318
|
+
return (isRecord(value) &&
|
|
319
|
+
value.schemaVersion === GIT_PULL_REQUEST_SCHEMA_VERSION &&
|
|
320
|
+
isBoolean(value.objectExists) &&
|
|
321
|
+
isBoolean(value.reviewReady) &&
|
|
322
|
+
isBlockerArray(value.blockers));
|
|
323
|
+
}
|
|
324
|
+
function isStringArray(value) {
|
|
325
|
+
return Array.isArray(value) && value.every(isString);
|
|
326
|
+
}
|
|
327
|
+
export function isGitPullRequestChangeNarrative(value) {
|
|
328
|
+
return (isRecord(value) &&
|
|
329
|
+
isNonNegativeInteger(value.commitCount) &&
|
|
330
|
+
isNonNegativeInteger(value.fileCount) &&
|
|
331
|
+
isNonNegativeInteger(value.areaCount) &&
|
|
332
|
+
isStringArray(value.areas) &&
|
|
333
|
+
isBoolean(value.touchesTests) &&
|
|
334
|
+
isGitPrChangeType(value.changeType));
|
|
335
|
+
}
|
|
336
|
+
export function isGitPullRequestMetadataDraft(value) {
|
|
337
|
+
return (isRecord(value) &&
|
|
338
|
+
value.schemaVersion === GIT_PULL_REQUEST_SCHEMA_VERSION &&
|
|
339
|
+
isString(value.composedTitle) &&
|
|
340
|
+
isRecord(value.summarySection) &&
|
|
341
|
+
isRecord(value.riskSection) &&
|
|
342
|
+
isRecord(value.changeNarrativeSection) &&
|
|
343
|
+
isString(value.riskNarrative));
|
|
344
|
+
}
|
|
345
|
+
// ─── Parse ──────────────────────────────────────────────────────────────────────────────────────────
|
|
346
|
+
export function parseGitPullRequestReadinessSummary(value) {
|
|
347
|
+
if (!isGitPullRequestReadinessSummary(value)) {
|
|
348
|
+
return { ok: false, errors: ["value is not a valid GitPullRequestReadinessSummary"] };
|
|
349
|
+
}
|
|
350
|
+
return { ok: true, value };
|
|
351
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export declare const GIT_REPOSITORY_AGENT_SCHEMA_VERSION: "1";
|
|
2
|
+
export type GitRepositoryAgentOperationMode = "read" | "preview" | "execute";
|
|
3
|
+
export declare const GIT_REPOSITORY_AGENT_OPERATION_MODES: readonly GitRepositoryAgentOperationMode[];
|
|
4
|
+
export type GitRepositoryAgentOperationKind = "status" | "diff" | "branch-list" | "branch-create" | "branch-switch" | "stage" | "unstage" | "commit" | "fetch" | "pull" | "push" | "pull-request" | "merge";
|
|
5
|
+
export declare const GIT_REPOSITORY_AGENT_OPERATION_KINDS: readonly GitRepositoryAgentOperationKind[];
|
|
6
|
+
export type GitRepositoryAgentDenialReason = "unsupported-direct-shell" | "unsupported-operation" | "idempotency-conflict" | "bad-request";
|
|
7
|
+
export declare const GIT_REPOSITORY_AGENT_DENIAL_REASONS: readonly GitRepositoryAgentDenialReason[];
|
|
8
|
+
export interface GitRepositoryAgentOperationRequest {
|
|
9
|
+
readonly schemaVersion: typeof GIT_REPOSITORY_AGENT_SCHEMA_VERSION;
|
|
10
|
+
readonly operation: GitRepositoryAgentOperationKind;
|
|
11
|
+
readonly mode: GitRepositoryAgentOperationMode;
|
|
12
|
+
readonly projectId: string;
|
|
13
|
+
readonly idempotencyKey?: string | undefined;
|
|
14
|
+
readonly payload?: Readonly<Record<string, unknown>> | undefined;
|
|
15
|
+
}
|
|
16
|
+
export interface GitRepositoryAgentOperationDelegatedResponse {
|
|
17
|
+
readonly schemaVersion: typeof GIT_REPOSITORY_AGENT_SCHEMA_VERSION;
|
|
18
|
+
readonly operation: GitRepositoryAgentOperationKind;
|
|
19
|
+
readonly mode: GitRepositoryAgentOperationMode;
|
|
20
|
+
readonly status: "delegated";
|
|
21
|
+
readonly routeStatus: number;
|
|
22
|
+
readonly replay?: boolean | undefined;
|
|
23
|
+
readonly response: unknown;
|
|
24
|
+
}
|
|
25
|
+
export interface GitRepositoryAgentOperationDeniedResponse {
|
|
26
|
+
readonly schemaVersion: typeof GIT_REPOSITORY_AGENT_SCHEMA_VERSION;
|
|
27
|
+
readonly operation?: GitRepositoryAgentOperationKind | undefined;
|
|
28
|
+
readonly mode?: GitRepositoryAgentOperationMode | undefined;
|
|
29
|
+
readonly status: "denied";
|
|
30
|
+
readonly denialReason: GitRepositoryAgentDenialReason;
|
|
31
|
+
readonly message: string;
|
|
32
|
+
}
|
|
33
|
+
export type GitRepositoryAgentOperationResponse = GitRepositoryAgentOperationDelegatedResponse | GitRepositoryAgentOperationDeniedResponse;
|
|
34
|
+
export interface GitRepositoryAgentParseOk {
|
|
35
|
+
readonly ok: true;
|
|
36
|
+
readonly value: GitRepositoryAgentOperationRequest;
|
|
37
|
+
}
|
|
38
|
+
export interface GitRepositoryAgentParseFail {
|
|
39
|
+
readonly ok: false;
|
|
40
|
+
readonly denialReason: GitRepositoryAgentDenialReason;
|
|
41
|
+
readonly message: string;
|
|
42
|
+
}
|
|
43
|
+
export type GitRepositoryAgentParseResult = GitRepositoryAgentParseOk | GitRepositoryAgentParseFail;
|
|
44
|
+
export declare function parseGitRepositoryAgentOperationRequest(input: unknown): GitRepositoryAgentParseResult;
|
|
45
|
+
export declare function isGitRepositoryAgentOperationResponse(input: unknown): input is GitRepositoryAgentOperationResponse;
|
|
46
|
+
//# sourceMappingURL=git-repository-agent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git-repository-agent.d.ts","sourceRoot":"","sources":["../src/git-repository-agent.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,mCAAmC,EAAG,GAAY,CAAC;AAEhE,MAAM,MAAM,+BAA+B,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,CAAC;AAE7E,eAAO,MAAM,oCAAoC,EAAE,SAAS,+BAA+B,EAIjF,CAAC;AAEX,MAAM,MAAM,+BAA+B,GACvC,QAAQ,GACR,MAAM,GACN,aAAa,GACb,eAAe,GACf,eAAe,GACf,OAAO,GACP,SAAS,GACT,QAAQ,GACR,OAAO,GACP,MAAM,GACN,MAAM,GACN,cAAc,GACd,OAAO,CAAC;AAEZ,eAAO,MAAM,oCAAoC,EAAE,SAAS,+BAA+B,EAcjF,CAAC;AAEX,MAAM,MAAM,8BAA8B,GACtC,0BAA0B,GAC1B,uBAAuB,GACvB,sBAAsB,GACtB,aAAa,CAAC;AAElB,eAAO,MAAM,mCAAmC,EAAE,SAAS,8BAA8B,EAK/E,CAAC;AAEX,MAAM,WAAW,kCAAkC;IACjD,QAAQ,CAAC,aAAa,EAAE,OAAO,mCAAmC,CAAC;IACnE,QAAQ,CAAC,SAAS,EAAE,+BAA+B,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E,EAAE,KAAK,CAAC;IACnB,QAAQ,CAAC,YAAY,EAAE,8BAA8B,CAAC;IACtD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,MAAM,6BAA6B,GACrC,yBAAyB,GACzB,2BAA2B,CAAC;AAsJhC,wBAAgB,uCAAuC,CACrD,KAAK,EAAE,OAAO,GACb,6BAA6B,CAwB/B;AAED,wBAAgB,qCAAqC,CACnD,KAAK,EAAE,OAAO,GACb,KAAK,IAAI,mCAAmC,CAgB9C"}
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
// Agent-facing repository operation facade contract (Issue #1577, Epic #1571).
|
|
2
|
+
// Pure wire types and validators only. The facade grants no shell, process, provider, credential, or
|
|
3
|
+
// model authority; server handlers must delegate to existing Git read and Git delivery routes.
|
|
4
|
+
export const GIT_REPOSITORY_AGENT_SCHEMA_VERSION = "1";
|
|
5
|
+
export const GIT_REPOSITORY_AGENT_OPERATION_MODES = [
|
|
6
|
+
"read",
|
|
7
|
+
"preview",
|
|
8
|
+
"execute",
|
|
9
|
+
];
|
|
10
|
+
export const GIT_REPOSITORY_AGENT_OPERATION_KINDS = [
|
|
11
|
+
"status",
|
|
12
|
+
"diff",
|
|
13
|
+
"branch-list",
|
|
14
|
+
"branch-create",
|
|
15
|
+
"branch-switch",
|
|
16
|
+
"stage",
|
|
17
|
+
"unstage",
|
|
18
|
+
"commit",
|
|
19
|
+
"fetch",
|
|
20
|
+
"pull",
|
|
21
|
+
"push",
|
|
22
|
+
"pull-request",
|
|
23
|
+
"merge",
|
|
24
|
+
];
|
|
25
|
+
export const GIT_REPOSITORY_AGENT_DENIAL_REASONS = [
|
|
26
|
+
"unsupported-direct-shell",
|
|
27
|
+
"unsupported-operation",
|
|
28
|
+
"idempotency-conflict",
|
|
29
|
+
"bad-request",
|
|
30
|
+
];
|
|
31
|
+
const TOP_LEVEL_KEYS = new Set([
|
|
32
|
+
"schemaVersion",
|
|
33
|
+
"idempotencyKey",
|
|
34
|
+
"operation",
|
|
35
|
+
"mode",
|
|
36
|
+
"projectId",
|
|
37
|
+
"payload",
|
|
38
|
+
]);
|
|
39
|
+
const DIRECT_SHELL_KEYS = new Set([
|
|
40
|
+
"argv",
|
|
41
|
+
"args",
|
|
42
|
+
"body",
|
|
43
|
+
"command",
|
|
44
|
+
"credential",
|
|
45
|
+
"endpoint",
|
|
46
|
+
"cwd",
|
|
47
|
+
"env",
|
|
48
|
+
"executable",
|
|
49
|
+
"ghEndpoint",
|
|
50
|
+
"gitSubcommand",
|
|
51
|
+
"headers",
|
|
52
|
+
"method",
|
|
53
|
+
"providerPayload",
|
|
54
|
+
"providerState",
|
|
55
|
+
"repositoryRoot",
|
|
56
|
+
"root",
|
|
57
|
+
"script",
|
|
58
|
+
"shell",
|
|
59
|
+
"token",
|
|
60
|
+
"url",
|
|
61
|
+
]);
|
|
62
|
+
const MODE_BY_OPERATION = {
|
|
63
|
+
status: ["read"],
|
|
64
|
+
diff: ["read"],
|
|
65
|
+
"branch-list": ["read"],
|
|
66
|
+
"branch-create": ["execute"],
|
|
67
|
+
"branch-switch": ["execute"],
|
|
68
|
+
stage: ["execute"],
|
|
69
|
+
unstage: ["execute"],
|
|
70
|
+
commit: ["preview", "execute"],
|
|
71
|
+
fetch: ["preview", "execute"],
|
|
72
|
+
pull: ["preview", "execute"],
|
|
73
|
+
push: ["preview", "execute"],
|
|
74
|
+
"pull-request": ["preview", "execute"],
|
|
75
|
+
merge: ["preview", "execute"],
|
|
76
|
+
};
|
|
77
|
+
function isRecord(value) {
|
|
78
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
79
|
+
}
|
|
80
|
+
function isOperation(value) {
|
|
81
|
+
return (typeof value === "string" &&
|
|
82
|
+
GIT_REPOSITORY_AGENT_OPERATION_KINDS.includes(value));
|
|
83
|
+
}
|
|
84
|
+
function isMode(value) {
|
|
85
|
+
return (typeof value === "string" &&
|
|
86
|
+
GIT_REPOSITORY_AGENT_OPERATION_MODES.includes(value));
|
|
87
|
+
}
|
|
88
|
+
function containsDirectShellShape(value) {
|
|
89
|
+
if (Array.isArray(value))
|
|
90
|
+
return value.some(containsDirectShellShape);
|
|
91
|
+
if (!isRecord(value))
|
|
92
|
+
return false;
|
|
93
|
+
for (const [key, child] of Object.entries(value)) {
|
|
94
|
+
if (DIRECT_SHELL_KEYS.has(key) || key.toLowerCase().includes("credential"))
|
|
95
|
+
return true;
|
|
96
|
+
if (containsDirectShellShape(child))
|
|
97
|
+
return true;
|
|
98
|
+
}
|
|
99
|
+
return false;
|
|
100
|
+
}
|
|
101
|
+
function parseFail(denialReason, message) {
|
|
102
|
+
return { ok: false, denialReason, message };
|
|
103
|
+
}
|
|
104
|
+
function validateEnvelope(input) {
|
|
105
|
+
if (!isRecord(input))
|
|
106
|
+
return parseFail("bad-request", "Request body must be an object.");
|
|
107
|
+
if (containsDirectShellShape(input)) {
|
|
108
|
+
return parseFail("unsupported-direct-shell", "Repository operations must use typed Git facade actions, not shell commands.");
|
|
109
|
+
}
|
|
110
|
+
for (const key of Object.keys(input)) {
|
|
111
|
+
if (!TOP_LEVEL_KEYS.has(key))
|
|
112
|
+
return parseFail("bad-request", "Request contains an extra field.");
|
|
113
|
+
}
|
|
114
|
+
if (input.schemaVersion !== GIT_REPOSITORY_AGENT_SCHEMA_VERSION) {
|
|
115
|
+
return parseFail("bad-request", "schemaVersion is invalid.");
|
|
116
|
+
}
|
|
117
|
+
return { ok: true, value: input };
|
|
118
|
+
}
|
|
119
|
+
function parseOperation(value) {
|
|
120
|
+
if (isOperation(value))
|
|
121
|
+
return value;
|
|
122
|
+
return parseFail("unsupported-operation", "Operation is not supported by the repository facade.");
|
|
123
|
+
}
|
|
124
|
+
function parseMode(operation, value) {
|
|
125
|
+
if (isMode(value) && MODE_BY_OPERATION[operation].includes(value))
|
|
126
|
+
return value;
|
|
127
|
+
return parseFail("bad-request", "Operation mode is invalid for this repository operation.");
|
|
128
|
+
}
|
|
129
|
+
function parseProjectId(value) {
|
|
130
|
+
if (typeof value === "string" && value.length > 0)
|
|
131
|
+
return value;
|
|
132
|
+
return parseFail("bad-request", "projectId must be a string.");
|
|
133
|
+
}
|
|
134
|
+
function parseIdempotencyKey(mode, value) {
|
|
135
|
+
if (value !== undefined && (typeof value !== "string" || value.length === 0)) {
|
|
136
|
+
return parseFail("bad-request", "idempotencyKey must be a non-empty string.");
|
|
137
|
+
}
|
|
138
|
+
if (mode === "execute" && value === undefined) {
|
|
139
|
+
return parseFail("bad-request", "execute operations require an idempotencyKey.");
|
|
140
|
+
}
|
|
141
|
+
return value;
|
|
142
|
+
}
|
|
143
|
+
function parsePayload(value) {
|
|
144
|
+
if (value === undefined)
|
|
145
|
+
return undefined;
|
|
146
|
+
if (isRecord(value))
|
|
147
|
+
return value;
|
|
148
|
+
return parseFail("bad-request", "payload must be an object.");
|
|
149
|
+
}
|
|
150
|
+
function isParseFail(value) {
|
|
151
|
+
return isRecord(value) && value.ok === false;
|
|
152
|
+
}
|
|
153
|
+
export function parseGitRepositoryAgentOperationRequest(input) {
|
|
154
|
+
const envelope = validateEnvelope(input);
|
|
155
|
+
if (isParseFail(envelope))
|
|
156
|
+
return envelope;
|
|
157
|
+
const operation = parseOperation(envelope.value.operation);
|
|
158
|
+
if (isParseFail(operation))
|
|
159
|
+
return operation;
|
|
160
|
+
const mode = parseMode(operation, envelope.value.mode);
|
|
161
|
+
if (isParseFail(mode))
|
|
162
|
+
return mode;
|
|
163
|
+
const projectId = parseProjectId(envelope.value.projectId);
|
|
164
|
+
if (isParseFail(projectId))
|
|
165
|
+
return projectId;
|
|
166
|
+
const idempotencyKey = parseIdempotencyKey(mode, envelope.value.idempotencyKey);
|
|
167
|
+
if (isParseFail(idempotencyKey))
|
|
168
|
+
return idempotencyKey;
|
|
169
|
+
const payload = parsePayload(envelope.value.payload);
|
|
170
|
+
if (isParseFail(payload))
|
|
171
|
+
return payload;
|
|
172
|
+
return {
|
|
173
|
+
ok: true,
|
|
174
|
+
value: {
|
|
175
|
+
schemaVersion: GIT_REPOSITORY_AGENT_SCHEMA_VERSION,
|
|
176
|
+
operation,
|
|
177
|
+
mode,
|
|
178
|
+
projectId,
|
|
179
|
+
...(idempotencyKey === undefined ? {} : { idempotencyKey }),
|
|
180
|
+
...(payload === undefined ? {} : { payload }),
|
|
181
|
+
},
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
export function isGitRepositoryAgentOperationResponse(input) {
|
|
185
|
+
if (!isRecord(input))
|
|
186
|
+
return false;
|
|
187
|
+
if (input.schemaVersion !== GIT_REPOSITORY_AGENT_SCHEMA_VERSION)
|
|
188
|
+
return false;
|
|
189
|
+
if (input.status === "delegated") {
|
|
190
|
+
return isOperation(input.operation) && isMode(input.mode) && typeof input.routeStatus === "number";
|
|
191
|
+
}
|
|
192
|
+
if (input.status === "denied") {
|
|
193
|
+
return (typeof input.message === "string" &&
|
|
194
|
+
typeof input.denialReason === "string" &&
|
|
195
|
+
GIT_REPOSITORY_AGENT_DENIAL_REASONS.includes(input.denialReason));
|
|
196
|
+
}
|
|
197
|
+
return false;
|
|
198
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { GitRepositoryState, GitUnavailableReason, GitRepositoryValidation } from "./git-repository.js";
|
|
2
|
+
export declare const GIT_REPOSITORY_SUMMARY_SCHEMA_VERSION: "1";
|
|
3
|
+
export interface GitRemoteSummary {
|
|
4
|
+
readonly name: string;
|
|
5
|
+
readonly fetchUrl?: string | undefined;
|
|
6
|
+
readonly pushUrl?: string | undefined;
|
|
7
|
+
}
|
|
8
|
+
export interface GitRepositorySummaryRemote {
|
|
9
|
+
readonly name: string;
|
|
10
|
+
}
|
|
11
|
+
export interface GitUpstreamSummary {
|
|
12
|
+
readonly ref: string;
|
|
13
|
+
readonly remote?: string | undefined;
|
|
14
|
+
readonly branch?: string | undefined;
|
|
15
|
+
}
|
|
16
|
+
export interface GitLastSyncMetadata {
|
|
17
|
+
readonly lastFetchAtMs?: number | undefined;
|
|
18
|
+
}
|
|
19
|
+
export interface GitRepositorySummary {
|
|
20
|
+
readonly schemaVersion: typeof GIT_REPOSITORY_SUMMARY_SCHEMA_VERSION;
|
|
21
|
+
readonly root: string;
|
|
22
|
+
readonly repositoryRoot?: string | undefined;
|
|
23
|
+
readonly state: GitRepositoryState;
|
|
24
|
+
readonly available: boolean;
|
|
25
|
+
readonly reason?: GitUnavailableReason | "unsafe-repository" | "git-error" | undefined;
|
|
26
|
+
readonly message?: string | undefined;
|
|
27
|
+
readonly branch?: string | undefined;
|
|
28
|
+
readonly detached: boolean;
|
|
29
|
+
readonly upstream?: GitUpstreamSummary | undefined;
|
|
30
|
+
readonly ahead: number;
|
|
31
|
+
readonly behind: number;
|
|
32
|
+
readonly stagedCount: number;
|
|
33
|
+
readonly unstagedCount: number;
|
|
34
|
+
readonly untrackedCount: number;
|
|
35
|
+
readonly conflictedCount: number;
|
|
36
|
+
readonly clean: boolean;
|
|
37
|
+
readonly remotes: readonly GitRepositorySummaryRemote[];
|
|
38
|
+
readonly lastSync?: GitLastSyncMetadata | undefined;
|
|
39
|
+
readonly truncated: boolean;
|
|
40
|
+
}
|
|
41
|
+
export interface GitRemotesResponse {
|
|
42
|
+
readonly schemaVersion: typeof GIT_REPOSITORY_SUMMARY_SCHEMA_VERSION;
|
|
43
|
+
readonly root: string;
|
|
44
|
+
readonly repositoryRoot?: string | undefined;
|
|
45
|
+
readonly state: GitRepositoryState;
|
|
46
|
+
readonly available: boolean;
|
|
47
|
+
readonly reason?: GitUnavailableReason | "unsafe-repository" | "git-error" | undefined;
|
|
48
|
+
readonly remotes: readonly GitRemoteSummary[];
|
|
49
|
+
readonly truncated: boolean;
|
|
50
|
+
}
|
|
51
|
+
export type GitRepositorySummaryValidation = GitRepositoryValidation;
|
|
52
|
+
export declare function validateGitRepositorySummary(input: unknown): GitRepositoryValidation;
|
|
53
|
+
export declare function validateGitRemotesResponse(input: unknown): GitRepositoryValidation;
|
|
54
|
+
//# sourceMappingURL=git-repository-summary.d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