@usepipr/runtime 0.1.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.
@@ -0,0 +1,967 @@
1
+ import { z } from "zod";
2
+ import { ReviewResult } from "@usepipr/sdk/review";
3
+ //#region src/config/init.d.ts
4
+ type InitTypeSupportMode = "include" | "skip" | "only";
5
+ type InitOfficialMinimalProjectResult = {
6
+ configDir: string;
7
+ created: string[];
8
+ overwritten: string[];
9
+ };
10
+ declare const supportedOfficialInitAdapters: readonly ["github"];
11
+ type OfficialInitAdapter = (typeof supportedOfficialInitAdapters)[number];
12
+ //#endregion
13
+ //#region src/review/contract.d.ts
14
+ type PrReview = ReviewResult;
15
+ //#endregion
16
+ //#region src/types.d.ts
17
+ declare const providerConfigSchema: z.ZodObject<{
18
+ id: z.ZodString;
19
+ provider: z.ZodString;
20
+ model: z.ZodString;
21
+ apiKeyEnv: z.ZodString;
22
+ thinking: z.ZodOptional<z.ZodEnum<{
23
+ off: "off";
24
+ minimal: "minimal";
25
+ low: "low";
26
+ medium: "medium";
27
+ high: "high";
28
+ xhigh: "xhigh";
29
+ }>>;
30
+ }, z.core.$strict>;
31
+ declare const piprConfigSchema: z.ZodObject<{
32
+ defaultProvider: z.ZodString;
33
+ providers: z.ZodArray<z.ZodObject<{
34
+ id: z.ZodString;
35
+ provider: z.ZodString;
36
+ model: z.ZodString;
37
+ apiKeyEnv: z.ZodString;
38
+ thinking: z.ZodOptional<z.ZodEnum<{
39
+ off: "off";
40
+ minimal: "minimal";
41
+ low: "low";
42
+ medium: "medium";
43
+ high: "high";
44
+ xhigh: "xhigh";
45
+ }>>;
46
+ }, z.core.$strict>>;
47
+ publication: z.ZodObject<{
48
+ maxInlineComments: z.ZodOptional<z.ZodNumber>;
49
+ autoResolve: z.ZodObject<{
50
+ enabled: z.ZodBoolean;
51
+ model: z.ZodOptional<z.ZodString>;
52
+ instructions: z.ZodOptional<z.ZodString>;
53
+ synchronize: z.ZodBoolean;
54
+ userReplies: z.ZodObject<{
55
+ enabled: z.ZodBoolean;
56
+ respondWhenStillValid: z.ZodBoolean;
57
+ allowedActors: z.ZodEnum<{
58
+ write: "write";
59
+ any: "any";
60
+ "author-or-write": "author-or-write";
61
+ }>;
62
+ }, z.core.$strict>;
63
+ }, z.core.$strict>;
64
+ }, z.core.$strict>;
65
+ limits: z.ZodOptional<z.ZodObject<{
66
+ timeoutSeconds: z.ZodOptional<z.ZodNumber>;
67
+ diffManifest: z.ZodOptional<z.ZodObject<{
68
+ fullMaxBytes: z.ZodOptional<z.ZodNumber>;
69
+ fullMaxEstimatedTokens: z.ZodOptional<z.ZodNumber>;
70
+ condensedMaxBytes: z.ZodOptional<z.ZodNumber>;
71
+ condensedMaxEstimatedTokens: z.ZodOptional<z.ZodNumber>;
72
+ toolResponseMaxBytes: z.ZodOptional<z.ZodNumber>;
73
+ }, z.core.$strict>>;
74
+ }, z.core.$strict>>;
75
+ }, z.core.$strict>;
76
+ declare const runtimeSettingsSchema: z.ZodObject<{
77
+ source: z.ZodString;
78
+ config: z.ZodObject<{
79
+ defaultProvider: z.ZodString;
80
+ providers: z.ZodArray<z.ZodObject<{
81
+ id: z.ZodString;
82
+ provider: z.ZodString;
83
+ model: z.ZodString;
84
+ apiKeyEnv: z.ZodString;
85
+ thinking: z.ZodOptional<z.ZodEnum<{
86
+ off: "off";
87
+ minimal: "minimal";
88
+ low: "low";
89
+ medium: "medium";
90
+ high: "high";
91
+ xhigh: "xhigh";
92
+ }>>;
93
+ }, z.core.$strict>>;
94
+ publication: z.ZodObject<{
95
+ maxInlineComments: z.ZodOptional<z.ZodNumber>;
96
+ autoResolve: z.ZodObject<{
97
+ enabled: z.ZodBoolean;
98
+ model: z.ZodOptional<z.ZodString>;
99
+ instructions: z.ZodOptional<z.ZodString>;
100
+ synchronize: z.ZodBoolean;
101
+ userReplies: z.ZodObject<{
102
+ enabled: z.ZodBoolean;
103
+ respondWhenStillValid: z.ZodBoolean;
104
+ allowedActors: z.ZodEnum<{
105
+ write: "write";
106
+ any: "any";
107
+ "author-or-write": "author-or-write";
108
+ }>;
109
+ }, z.core.$strict>;
110
+ }, z.core.$strict>;
111
+ }, z.core.$strict>;
112
+ limits: z.ZodOptional<z.ZodObject<{
113
+ timeoutSeconds: z.ZodOptional<z.ZodNumber>;
114
+ diffManifest: z.ZodOptional<z.ZodObject<{
115
+ fullMaxBytes: z.ZodOptional<z.ZodNumber>;
116
+ fullMaxEstimatedTokens: z.ZodOptional<z.ZodNumber>;
117
+ condensedMaxBytes: z.ZodOptional<z.ZodNumber>;
118
+ condensedMaxEstimatedTokens: z.ZodOptional<z.ZodNumber>;
119
+ toolResponseMaxBytes: z.ZodOptional<z.ZodNumber>;
120
+ }, z.core.$strict>>;
121
+ }, z.core.$strict>>;
122
+ }, z.core.$strict>;
123
+ warnings: z.ZodArray<z.ZodString>;
124
+ }, z.core.$strict>;
125
+ declare const platformInfoSchema: z.ZodObject<{
126
+ id: z.ZodString;
127
+ host: z.ZodOptional<z.ZodString>;
128
+ }, z.core.$strict>;
129
+ declare const repositoryRefSchema: z.ZodObject<{
130
+ slug: z.ZodString;
131
+ url: z.ZodOptional<z.ZodString>;
132
+ }, z.core.$strict>;
133
+ declare const changeRequestRefSchema: z.ZodObject<{
134
+ number: z.ZodNumber;
135
+ title: z.ZodDefault<z.ZodString>;
136
+ description: z.ZodDefault<z.ZodString>;
137
+ url: z.ZodOptional<z.ZodString>;
138
+ author: z.ZodOptional<z.ZodObject<{
139
+ login: z.ZodString;
140
+ }, z.core.$strict>>;
141
+ base: z.ZodObject<{
142
+ sha: z.ZodString;
143
+ ref: z.ZodOptional<z.ZodString>;
144
+ url: z.ZodOptional<z.ZodString>;
145
+ author: z.ZodOptional<z.ZodObject<{
146
+ login: z.ZodString;
147
+ }, z.core.$strict>>;
148
+ fork: z.ZodOptional<z.ZodBoolean>;
149
+ }, z.core.$strict>;
150
+ head: z.ZodObject<{
151
+ sha: z.ZodString;
152
+ ref: z.ZodOptional<z.ZodString>;
153
+ url: z.ZodOptional<z.ZodString>;
154
+ author: z.ZodOptional<z.ZodObject<{
155
+ login: z.ZodString;
156
+ }, z.core.$strict>>;
157
+ fork: z.ZodOptional<z.ZodBoolean>;
158
+ }, z.core.$strict>;
159
+ isFork: z.ZodOptional<z.ZodBoolean>;
160
+ }, z.core.$strict>;
161
+ declare const changeRequestEventContextSchema: z.ZodObject<{
162
+ eventName: z.ZodString;
163
+ action: z.ZodOptional<z.ZodString>;
164
+ rawAction: z.ZodOptional<z.ZodString>;
165
+ platform: z.ZodObject<{
166
+ id: z.ZodString;
167
+ host: z.ZodOptional<z.ZodString>;
168
+ }, z.core.$strict>;
169
+ repository: z.ZodObject<{
170
+ slug: z.ZodString;
171
+ url: z.ZodOptional<z.ZodString>;
172
+ }, z.core.$strict>;
173
+ change: z.ZodObject<{
174
+ number: z.ZodNumber;
175
+ title: z.ZodDefault<z.ZodString>;
176
+ description: z.ZodDefault<z.ZodString>;
177
+ url: z.ZodOptional<z.ZodString>;
178
+ author: z.ZodOptional<z.ZodObject<{
179
+ login: z.ZodString;
180
+ }, z.core.$strict>>;
181
+ base: z.ZodObject<{
182
+ sha: z.ZodString;
183
+ ref: z.ZodOptional<z.ZodString>;
184
+ url: z.ZodOptional<z.ZodString>;
185
+ author: z.ZodOptional<z.ZodObject<{
186
+ login: z.ZodString;
187
+ }, z.core.$strict>>;
188
+ fork: z.ZodOptional<z.ZodBoolean>;
189
+ }, z.core.$strict>;
190
+ head: z.ZodObject<{
191
+ sha: z.ZodString;
192
+ ref: z.ZodOptional<z.ZodString>;
193
+ url: z.ZodOptional<z.ZodString>;
194
+ author: z.ZodOptional<z.ZodObject<{
195
+ login: z.ZodString;
196
+ }, z.core.$strict>>;
197
+ fork: z.ZodOptional<z.ZodBoolean>;
198
+ }, z.core.$strict>;
199
+ isFork: z.ZodOptional<z.ZodBoolean>;
200
+ }, z.core.$strict>;
201
+ workspace: z.ZodString;
202
+ }, z.core.$strict>;
203
+ declare const diffManifestSchema: z.ZodObject<{
204
+ baseSha: z.ZodString;
205
+ headSha: z.ZodString;
206
+ mergeBaseSha: z.ZodString;
207
+ files: z.ZodArray<z.ZodObject<{
208
+ path: z.ZodString;
209
+ previousPath: z.ZodOptional<z.ZodString>;
210
+ status: z.ZodEnum<{
211
+ added: "added";
212
+ modified: "modified";
213
+ removed: "removed";
214
+ renamed: "renamed";
215
+ }>;
216
+ language: z.ZodOptional<z.ZodString>;
217
+ additions: z.ZodNumber;
218
+ deletions: z.ZodNumber;
219
+ hunks: z.ZodArray<z.ZodObject<{
220
+ hunkIndex: z.ZodNumber;
221
+ header: z.ZodString;
222
+ oldStart: z.ZodNumber;
223
+ oldLines: z.ZodNumber;
224
+ newStart: z.ZodNumber;
225
+ newLines: z.ZodNumber;
226
+ contentHash: z.ZodString;
227
+ }, z.core.$strict>>;
228
+ commentableRanges: z.ZodArray<z.ZodObject<{
229
+ id: z.ZodString;
230
+ path: z.ZodString;
231
+ side: z.ZodEnum<{
232
+ RIGHT: "RIGHT";
233
+ LEFT: "LEFT";
234
+ }>;
235
+ startLine: z.ZodNumber;
236
+ endLine: z.ZodNumber;
237
+ kind: z.ZodEnum<{
238
+ added: "added";
239
+ deleted: "deleted";
240
+ context: "context";
241
+ mixed: "mixed";
242
+ }>;
243
+ hunkIndex: z.ZodNumber;
244
+ hunkHeader: z.ZodString;
245
+ hunkContentHash: z.ZodString;
246
+ summary: z.ZodOptional<z.ZodString>;
247
+ preview: z.ZodOptional<z.ZodString>;
248
+ }, z.core.$strict>>;
249
+ signals: z.ZodOptional<z.ZodArray<z.ZodString>>;
250
+ changedSymbols: z.ZodOptional<z.ZodArray<z.ZodString>>;
251
+ excludedReason: z.ZodOptional<z.ZodString>;
252
+ }, z.core.$strict>>;
253
+ }, z.core.$strict>;
254
+ declare const validatedReviewSchema: z.ZodObject<{
255
+ review: import("@usepipr/sdk").ZodSchema<import("@usepipr/sdk").ReviewResult>;
256
+ validFindings: z.ZodArray<import("@usepipr/sdk").ZodSchema<import("@usepipr/sdk").ReviewFinding>>;
257
+ droppedFindings: z.ZodArray<z.ZodObject<{
258
+ finding: import("@usepipr/sdk").ZodSchema<import("@usepipr/sdk").ReviewFinding>;
259
+ reason: z.ZodString;
260
+ }, z.core.$strict>>;
261
+ }, z.core.$strict>;
262
+ declare const commandPermissionLevelSchema: z.ZodEnum<{
263
+ read: "read";
264
+ write: "write";
265
+ triage: "triage";
266
+ maintain: "maintain";
267
+ admin: "admin";
268
+ }>;
269
+ type ProviderConfig = z.infer<typeof providerConfigSchema>;
270
+ type PiprConfig = z.infer<typeof piprConfigSchema>;
271
+ type RuntimeSettings = z.infer<typeof runtimeSettingsSchema>;
272
+ type PlatformInfo = z.infer<typeof platformInfoSchema>;
273
+ type RepositoryRef = z.infer<typeof repositoryRefSchema>;
274
+ type ChangeRequestRef = z.infer<typeof changeRequestRefSchema>;
275
+ type ChangeRequestEventContext = z.infer<typeof changeRequestEventContextSchema>;
276
+ type DiffManifest = z.infer<typeof diffManifestSchema>;
277
+ type ValidatedReview = z.infer<typeof validatedReviewSchema>;
278
+ type CommandPermissionLevel = z.infer<typeof commandPermissionLevelSchema>;
279
+ //#endregion
280
+ //#region src/config/project.d.ts
281
+ type InspectRuntimePlan = {
282
+ source: string;
283
+ models: string[];
284
+ agents: string[];
285
+ tasks: string[];
286
+ events: Array<{
287
+ task: string;
288
+ actions: string[];
289
+ }>;
290
+ commands: Array<{
291
+ pattern: string;
292
+ task: string;
293
+ permission: string;
294
+ }>;
295
+ tools: string[];
296
+ schemas: string[];
297
+ };
298
+ //#endregion
299
+ //#region src/review/prior-state.d.ts
300
+ declare const priorReviewStateSchema: z.ZodObject<{
301
+ version: z.ZodLiteral<1>;
302
+ reviewedHeadSha: z.ZodString;
303
+ selectedTasks: z.ZodArray<z.ZodString>;
304
+ findings: z.ZodArray<z.ZodObject<{
305
+ id: z.ZodString;
306
+ status: z.ZodEnum<{
307
+ open: "open";
308
+ resolved: "resolved";
309
+ }>;
310
+ path: z.ZodString;
311
+ rangeId: z.ZodString;
312
+ side: z.ZodEnum<{
313
+ RIGHT: "RIGHT";
314
+ LEFT: "LEFT";
315
+ }>;
316
+ startLine: z.ZodNumber;
317
+ endLine: z.ZodNumber;
318
+ firstSeenHeadSha: z.ZodString;
319
+ lastSeenHeadSha: z.ZodString;
320
+ lastCommentedHeadSha: z.ZodOptional<z.ZodString>;
321
+ }, z.core.$strict>>;
322
+ }, z.core.$strict>;
323
+ type PriorReviewState = z.infer<typeof priorReviewStateSchema>;
324
+ //#endregion
325
+ //#region src/review/comment.d.ts
326
+ declare const inlinePublicationItemSchema: z.ZodObject<{
327
+ finding: import("@usepipr/sdk").ZodSchema<import("@usepipr/sdk").ReviewFinding>;
328
+ range: z.ZodObject<{
329
+ id: z.ZodString;
330
+ path: z.ZodString;
331
+ side: z.ZodEnum<{
332
+ RIGHT: "RIGHT";
333
+ LEFT: "LEFT";
334
+ }>;
335
+ startLine: z.ZodNumber;
336
+ endLine: z.ZodNumber;
337
+ kind: z.ZodEnum<{
338
+ added: "added";
339
+ deleted: "deleted";
340
+ context: "context";
341
+ mixed: "mixed";
342
+ }>;
343
+ hunkIndex: z.ZodNumber;
344
+ hunkHeader: z.ZodString;
345
+ hunkContentHash: z.ZodString;
346
+ summary: z.ZodOptional<z.ZodString>;
347
+ preview: z.ZodOptional<z.ZodString>;
348
+ }, z.core.$strict>;
349
+ path: z.ZodString;
350
+ side: z.ZodEnum<{
351
+ RIGHT: "RIGHT";
352
+ LEFT: "LEFT";
353
+ }>;
354
+ startLine: z.ZodNumber;
355
+ endLine: z.ZodNumber;
356
+ body: z.ZodString;
357
+ marker: z.ZodString;
358
+ findingId: z.ZodString;
359
+ reviewedHeadSha: z.ZodString;
360
+ }, z.core.$strict>;
361
+ type InlinePublicationItem = z.infer<typeof inlinePublicationItemSchema>;
362
+ type InlineCommentDraft = InlinePublicationItem;
363
+ declare const threadActionSchema: z.ZodObject<{
364
+ kind: z.ZodEnum<{
365
+ resolve: "resolve";
366
+ reply: "reply";
367
+ }>;
368
+ findingId: z.ZodString;
369
+ findingHeadSha: z.ZodString;
370
+ commentId: z.ZodNumber;
371
+ threadId: z.ZodOptional<z.ZodString>;
372
+ body: z.ZodString;
373
+ responseKey: z.ZodString;
374
+ }, z.core.$strict>;
375
+ type ThreadAction = z.infer<typeof threadActionSchema>;
376
+ declare const publicationMetadataSchema: z.ZodObject<{
377
+ runtimeVersion: z.ZodString;
378
+ trustedConfigSha: z.ZodOptional<z.ZodString>;
379
+ trustedConfigHash: z.ZodOptional<z.ZodString>;
380
+ reviewedHeadSha: z.ZodString;
381
+ providerModels: z.ZodOptional<z.ZodArray<z.ZodString>>;
382
+ selectedTasks: z.ZodArray<z.ZodString>;
383
+ failedTasks: z.ZodArray<z.ZodString>;
384
+ validFindings: z.ZodNumber;
385
+ droppedFindings: z.ZodNumber;
386
+ cappedInlineFindings: z.ZodNumber;
387
+ }, z.core.$strict>;
388
+ type PublicationMetadata = z.infer<typeof publicationMetadataSchema>;
389
+ declare const publicationPlanSchema: z.ZodObject<{
390
+ mainComment: z.ZodString;
391
+ mainMarker: z.ZodString;
392
+ changeNumber: z.ZodNumber;
393
+ inlineItems: z.ZodArray<z.ZodObject<{
394
+ finding: import("@usepipr/sdk").ZodSchema<import("@usepipr/sdk").ReviewFinding>;
395
+ range: z.ZodObject<{
396
+ id: z.ZodString;
397
+ path: z.ZodString;
398
+ side: z.ZodEnum<{
399
+ RIGHT: "RIGHT";
400
+ LEFT: "LEFT";
401
+ }>;
402
+ startLine: z.ZodNumber;
403
+ endLine: z.ZodNumber;
404
+ kind: z.ZodEnum<{
405
+ added: "added";
406
+ deleted: "deleted";
407
+ context: "context";
408
+ mixed: "mixed";
409
+ }>;
410
+ hunkIndex: z.ZodNumber;
411
+ hunkHeader: z.ZodString;
412
+ hunkContentHash: z.ZodString;
413
+ summary: z.ZodOptional<z.ZodString>;
414
+ preview: z.ZodOptional<z.ZodString>;
415
+ }, z.core.$strict>;
416
+ path: z.ZodString;
417
+ side: z.ZodEnum<{
418
+ RIGHT: "RIGHT";
419
+ LEFT: "LEFT";
420
+ }>;
421
+ startLine: z.ZodNumber;
422
+ endLine: z.ZodNumber;
423
+ body: z.ZodString;
424
+ marker: z.ZodString;
425
+ findingId: z.ZodString;
426
+ reviewedHeadSha: z.ZodString;
427
+ }, z.core.$strict>>;
428
+ metadata: z.ZodObject<{
429
+ runtimeVersion: z.ZodString;
430
+ trustedConfigSha: z.ZodOptional<z.ZodString>;
431
+ trustedConfigHash: z.ZodOptional<z.ZodString>;
432
+ reviewedHeadSha: z.ZodString;
433
+ providerModels: z.ZodOptional<z.ZodArray<z.ZodString>>;
434
+ selectedTasks: z.ZodArray<z.ZodString>;
435
+ failedTasks: z.ZodArray<z.ZodString>;
436
+ validFindings: z.ZodNumber;
437
+ droppedFindings: z.ZodNumber;
438
+ cappedInlineFindings: z.ZodNumber;
439
+ }, z.core.$strict>;
440
+ reviewState: z.ZodObject<{
441
+ version: z.ZodLiteral<1>;
442
+ reviewedHeadSha: z.ZodString;
443
+ selectedTasks: z.ZodArray<z.ZodString>;
444
+ findings: z.ZodArray<z.ZodObject<{
445
+ id: z.ZodString;
446
+ status: z.ZodEnum<{
447
+ open: "open";
448
+ resolved: "resolved";
449
+ }>;
450
+ path: z.ZodString;
451
+ rangeId: z.ZodString;
452
+ side: z.ZodEnum<{
453
+ RIGHT: "RIGHT";
454
+ LEFT: "LEFT";
455
+ }>;
456
+ startLine: z.ZodNumber;
457
+ endLine: z.ZodNumber;
458
+ firstSeenHeadSha: z.ZodString;
459
+ lastSeenHeadSha: z.ZodString;
460
+ lastCommentedHeadSha: z.ZodOptional<z.ZodString>;
461
+ }, z.core.$strict>>;
462
+ }, z.core.$strict>;
463
+ threadActions: z.ZodArray<z.ZodObject<{
464
+ kind: z.ZodEnum<{
465
+ resolve: "resolve";
466
+ reply: "reply";
467
+ }>;
468
+ findingId: z.ZodString;
469
+ findingHeadSha: z.ZodString;
470
+ commentId: z.ZodNumber;
471
+ threadId: z.ZodOptional<z.ZodString>;
472
+ body: z.ZodString;
473
+ responseKey: z.ZodString;
474
+ }, z.core.$strict>>;
475
+ }, z.core.$strict>;
476
+ type PublicationPlan = z.infer<typeof publicationPlanSchema>;
477
+ //#endregion
478
+ //#region src/review/publication-result.d.ts
479
+ type PublicationResult = {
480
+ mainComment: {
481
+ action: "created" | "updated";
482
+ id: number;
483
+ };
484
+ inlineComments: {
485
+ posted: number;
486
+ skipped: number;
487
+ failed: number;
488
+ };
489
+ metadata: PublicationMetadata & {
490
+ inlinePublicationErrors: string[];
491
+ inlineResolutionErrors: string[];
492
+ };
493
+ };
494
+ /** Error thrown when publication fails after producing partial result metadata. */
495
+ declare class PublicationError extends Error {
496
+ readonly result: Omit<PublicationResult, "mainComment"> | undefined;
497
+ constructor(message: string, result: Omit<PublicationResult, "mainComment"> | undefined);
498
+ }
499
+ //#endregion
500
+ //#region src/hosts/types.d.ts
501
+ type HostEventParseOptions = {
502
+ eventPath: string;
503
+ env: NodeJS.ProcessEnv;
504
+ workspace: string;
505
+ };
506
+ type CommandCommentEvent = {
507
+ eventName: string;
508
+ action?: string;
509
+ rawAction?: string;
510
+ repository: RepositoryRef;
511
+ changeNumber: number;
512
+ commentId: number;
513
+ isChangeRequest: boolean;
514
+ body: string;
515
+ actor: string;
516
+ workspace: string;
517
+ };
518
+ type CommandResponsePublicationResult = {
519
+ action: "created" | "updated";
520
+ id: number;
521
+ };
522
+ type InlineThreadContext = {
523
+ findingId: string;
524
+ findingHeadSha: string;
525
+ parentCommentId: number;
526
+ parentBody: string;
527
+ threadId?: string;
528
+ threadResolved: boolean;
529
+ comments: Array<{
530
+ id: number;
531
+ body: string;
532
+ authorLogin?: string;
533
+ }>;
534
+ };
535
+ type ReviewCommentReplyEvent = {
536
+ eventName: string;
537
+ action?: string;
538
+ rawAction?: string;
539
+ repository: RepositoryRef;
540
+ changeNumber: number;
541
+ commentId: number;
542
+ parentCommentId?: number;
543
+ body: string;
544
+ actor: string;
545
+ workspace: string;
546
+ };
547
+ type LoadedChangeRequest = {
548
+ repository: RepositoryRef;
549
+ change: ChangeRequestRef;
550
+ eventName?: string;
551
+ action?: string;
552
+ rawAction?: string;
553
+ workspace?: string;
554
+ };
555
+ type RepositoryPermission = CommandPermissionLevel | "none";
556
+ type CodeHostCheckConclusion = "success" | "failure" | "neutral";
557
+ type CodeHostCheckRun = {
558
+ id: number | string;
559
+ name: string;
560
+ };
561
+ type CodeHostEvents = {
562
+ parseEvent(options: HostEventParseOptions): Promise<ChangeRequestEventContext>;
563
+ loadChangeRequest(ref: {
564
+ repository: RepositoryRef;
565
+ changeNumber: number;
566
+ workspace?: string;
567
+ eventName?: string;
568
+ action?: string;
569
+ rawAction?: string;
570
+ }): Promise<LoadedChangeRequest>;
571
+ resolveCommandComment(options: HostEventParseOptions): Promise<CommandCommentEvent>;
572
+ resolveReviewCommentReply?(options: HostEventParseOptions): Promise<ReviewCommentReplyEvent>;
573
+ };
574
+ type CodeHostPermissions = {
575
+ getRepositoryPermission(options: {
576
+ repository: RepositoryRef;
577
+ actor: string;
578
+ }): Promise<RepositoryPermission>;
579
+ };
580
+ type CodeHostWorkspace = {
581
+ ensureHeadCheckout(options: {
582
+ rootDir: string;
583
+ change: ChangeRequestEventContext;
584
+ }): void;
585
+ ensureWorkspaceSafeDirectory?(options: {
586
+ rootDir: string;
587
+ env?: NodeJS.ProcessEnv;
588
+ }): void;
589
+ };
590
+ type CodeHostPublication = {
591
+ publish(options: {
592
+ plan: PublicationPlan;
593
+ change: ChangeRequestEventContext;
594
+ }): Promise<PublicationResult>;
595
+ publishCommandResponse?(options: {
596
+ change: ChangeRequestEventContext;
597
+ sourceCommentId: number;
598
+ commandName: string;
599
+ body: string;
600
+ }): Promise<CommandResponsePublicationResult>;
601
+ publishThreadActions?(options: {
602
+ change: ChangeRequestEventContext;
603
+ actions: ThreadAction[];
604
+ reviewedHeadSha: string;
605
+ }): Promise<{
606
+ errors: string[];
607
+ }>;
608
+ };
609
+ type CodeHostComments = {
610
+ loadPriorReviewState?(options: {
611
+ change: ChangeRequestEventContext;
612
+ }): Promise<PriorReviewState | undefined>;
613
+ loadPriorMainComment?(options: {
614
+ change: ChangeRequestEventContext;
615
+ }): Promise<string | undefined>;
616
+ loadInlineThreadContexts?(options: {
617
+ change: ChangeRequestEventContext;
618
+ }): Promise<InlineThreadContext[]>;
619
+ };
620
+ type CodeHostChecks = {
621
+ createCheckRun?(options: {
622
+ change: ChangeRequestEventContext;
623
+ name: string;
624
+ summary?: string;
625
+ }): Promise<CodeHostCheckRun>;
626
+ updateCheckRun?(options: {
627
+ change: ChangeRequestEventContext;
628
+ checkRun: CodeHostCheckRun;
629
+ conclusion: CodeHostCheckConclusion;
630
+ summary?: string;
631
+ }): Promise<void>;
632
+ };
633
+ type CodeHostAdapter = {
634
+ id: string;
635
+ events: CodeHostEvents;
636
+ workspace: CodeHostWorkspace;
637
+ permissions: CodeHostPermissions;
638
+ publication?: CodeHostPublication;
639
+ comments?: CodeHostComments;
640
+ checks?: CodeHostChecks;
641
+ };
642
+ //#endregion
643
+ //#region src/hosts/github/command.d.ts
644
+ type GitHubPullRequestDetails = {
645
+ repository: RepositoryRef;
646
+ change: ChangeRequestRef;
647
+ };
648
+ type GitHubCommandClient = {
649
+ getPullRequest(options: {
650
+ repository: RepositoryRef;
651
+ changeNumber: number;
652
+ }): Promise<GitHubPullRequestDetails>;
653
+ getRepositoryPermission(options: {
654
+ repository: RepositoryRef;
655
+ actor: string;
656
+ }): Promise<RepositoryPermission>;
657
+ };
658
+ //#endregion
659
+ //#region src/hosts/github/publication-client.d.ts
660
+ declare const githubIssueCommentSchema: z.ZodPipe<z.ZodObject<{
661
+ id: z.ZodNumber;
662
+ body: z.ZodOptional<z.ZodNullable<z.ZodString>>;
663
+ user: z.ZodOptional<z.ZodObject<{
664
+ login: z.ZodString;
665
+ }, z.core.$loose>>;
666
+ }, z.core.$loose>, z.ZodTransform<{
667
+ id: number;
668
+ body: string | null | undefined;
669
+ authorLogin: string | undefined;
670
+ }, {
671
+ [x: string]: unknown;
672
+ id: number;
673
+ body?: string | null | undefined;
674
+ user?: {
675
+ [x: string]: unknown;
676
+ login: string;
677
+ } | undefined;
678
+ }>>;
679
+ declare const githubReviewCommentSchema: z.ZodPipe<z.ZodObject<{
680
+ path: z.ZodOptional<z.ZodString>;
681
+ commit_id: z.ZodOptional<z.ZodString>;
682
+ line: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
683
+ start_line: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
684
+ side: z.ZodOptional<z.ZodEnum<{
685
+ RIGHT: "RIGHT";
686
+ LEFT: "LEFT";
687
+ }>>;
688
+ start_side: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
689
+ RIGHT: "RIGHT";
690
+ LEFT: "LEFT";
691
+ }>>>;
692
+ user: z.ZodOptional<z.ZodObject<{
693
+ login: z.ZodString;
694
+ }, z.core.$loose>>;
695
+ id: z.ZodNumber;
696
+ body: z.ZodOptional<z.ZodNullable<z.ZodString>>;
697
+ }, z.core.$loose>, z.ZodTransform<{
698
+ id: number;
699
+ body: string | null | undefined;
700
+ authorLogin: string | undefined;
701
+ path: string | undefined;
702
+ commitId: string | undefined;
703
+ line: number | undefined;
704
+ startLine: number | undefined;
705
+ side: "RIGHT" | "LEFT" | undefined;
706
+ startSide: "RIGHT" | "LEFT" | undefined;
707
+ }, {
708
+ [x: string]: unknown;
709
+ id: number;
710
+ path?: string | undefined;
711
+ commit_id?: string | undefined;
712
+ line?: number | null | undefined;
713
+ start_line?: number | null | undefined;
714
+ side?: "RIGHT" | "LEFT" | undefined;
715
+ start_side?: "RIGHT" | "LEFT" | null | undefined;
716
+ user?: {
717
+ [x: string]: unknown;
718
+ login: string;
719
+ } | undefined;
720
+ body?: string | null | undefined;
721
+ }>>;
722
+ declare const githubReviewThreadSchema: z.ZodObject<{
723
+ id: z.ZodString;
724
+ isResolved: z.ZodBoolean;
725
+ commentIds: z.ZodArray<z.ZodNumber>;
726
+ }, z.core.$strict>;
727
+ declare const githubCheckRunSchema: z.ZodObject<{
728
+ id: z.ZodNumber;
729
+ name: z.ZodString;
730
+ }, z.core.$loose>;
731
+ type GitHubIssueComment = z.infer<typeof githubIssueCommentSchema>;
732
+ type GitHubReviewComment = z.infer<typeof githubReviewCommentSchema>;
733
+ type GitHubReviewThread = z.infer<typeof githubReviewThreadSchema>;
734
+ type GitHubCheckRun = z.infer<typeof githubCheckRunSchema>;
735
+ type GitHubPublicationClient = {
736
+ getAuthenticatedUserLogin(): Promise<string>;
737
+ getPullRequestHeadSha(options: {
738
+ repo: string;
739
+ pullRequestNumber: number;
740
+ }): Promise<string>;
741
+ listIssueComments(options: {
742
+ repo: string;
743
+ issueNumber: number;
744
+ }): Promise<GitHubIssueComment[]>;
745
+ createIssueComment(options: {
746
+ repo: string;
747
+ issueNumber: number;
748
+ body: string;
749
+ }): Promise<{
750
+ id: number;
751
+ }>;
752
+ updateIssueComment(options: {
753
+ repo: string;
754
+ commentId: number;
755
+ body: string;
756
+ }): Promise<{
757
+ id: number;
758
+ }>;
759
+ listReviewComments(options: {
760
+ repo: string;
761
+ pullRequestNumber: number;
762
+ }): Promise<GitHubReviewComment[]>;
763
+ listReviewThreads(options: {
764
+ repo: string;
765
+ pullRequestNumber: number;
766
+ }): Promise<GitHubReviewThread[]>;
767
+ createReviewComment(options: {
768
+ repo: string;
769
+ pullRequestNumber: number;
770
+ body: string;
771
+ path: string;
772
+ commit_id: string;
773
+ line: number;
774
+ side: "RIGHT" | "LEFT";
775
+ start_line?: number;
776
+ start_side?: "RIGHT" | "LEFT";
777
+ }): Promise<{
778
+ id: number;
779
+ }>;
780
+ createReviewCommentReply(options: {
781
+ repo: string;
782
+ pullRequestNumber: number;
783
+ commentId: number;
784
+ body: string;
785
+ }): Promise<{
786
+ id: number;
787
+ }>;
788
+ resolveReviewThread(options: {
789
+ threadId: string;
790
+ }): Promise<void>;
791
+ createCheckRun(options: {
792
+ repo: string;
793
+ name: string;
794
+ headSha: string;
795
+ summary?: string;
796
+ }): Promise<GitHubCheckRun>;
797
+ updateCheckRun(options: {
798
+ repo: string;
799
+ checkRunId: number;
800
+ name: string;
801
+ conclusion: "success" | "failure" | "neutral";
802
+ summary?: string;
803
+ }): Promise<void>;
804
+ };
805
+ //#endregion
806
+ //#region src/shared/logging.d.ts
807
+ type ActionLogSink = {
808
+ info(message: string): void;
809
+ notice(message: string): void;
810
+ warning(message: string): void;
811
+ error(message: string): void;
812
+ debug(message: string): void;
813
+ group<T>(name: string, run: () => Promise<T>): Promise<T>;
814
+ };
815
+ //#endregion
816
+ //#region src/review/task/task-output.d.ts
817
+ type RuntimeCheckConclusion = "success" | "failure" | "neutral";
818
+ type RuntimeTaskCheckResult = {
819
+ taskName: string;
820
+ conclusion: RuntimeCheckConclusion;
821
+ summary?: string;
822
+ };
823
+ //#endregion
824
+ //#region src/review/task/task-runtime.d.ts
825
+ type ReviewRuntimeBaseResult = {
826
+ provider: ProviderConfig;
827
+ diffManifest: DiffManifest;
828
+ taskChecks: RuntimeTaskCheckResult[];
829
+ repairAttempted: boolean;
830
+ };
831
+ type ReviewRuntimeResult = (ReviewRuntimeBaseResult & {
832
+ kind: "review";
833
+ review: PrReview;
834
+ validated: ValidatedReview;
835
+ publicationPlan: PublicationPlan;
836
+ mainComment: string;
837
+ inlineCommentDrafts: InlineCommentDraft[];
838
+ commandResponse?: never;
839
+ }) | (ReviewRuntimeBaseResult & {
840
+ kind: "skipped";
841
+ skipReason: string;
842
+ review: PrReview;
843
+ validated: ValidatedReview;
844
+ publicationPlan: PublicationPlan;
845
+ mainComment: string;
846
+ inlineCommentDrafts: InlineCommentDraft[];
847
+ commandResponse?: never;
848
+ }) | (ReviewRuntimeBaseResult & {
849
+ kind: "command-response";
850
+ commandResponse: {
851
+ commandName: string;
852
+ line: string;
853
+ arguments: Record<string, string>;
854
+ body: string;
855
+ };
856
+ review?: never;
857
+ validated?: never;
858
+ publicationPlan?: never;
859
+ mainComment?: never;
860
+ inlineCommentDrafts?: never;
861
+ });
862
+ //#endregion
863
+ //#region src/action/types.d.ts
864
+ type RuntimeCommandOptions = {
865
+ rootDir: string;
866
+ configDir: string;
867
+ env?: NodeJS.ProcessEnv;
868
+ requireProviderEnv?: boolean;
869
+ };
870
+ type InitCommandOptions = RuntimeCommandOptions & {
871
+ force: boolean;
872
+ adapters?: readonly string[];
873
+ recipe?: string;
874
+ typeSupport?: InitTypeSupportMode;
875
+ };
876
+ type DryRunCommandOptions = RuntimeCommandOptions & {
877
+ eventPath: string;
878
+ };
879
+ type ActionCommandOptions = RuntimeCommandOptions & {
880
+ eventPath: string;
881
+ dryRun: boolean;
882
+ logSink?: ActionLogSink;
883
+ };
884
+ type ActionCommandDependencyOptions = ActionCommandOptions & {
885
+ piExecutable?: string;
886
+ hostAdapter?: CodeHostAdapter;
887
+ githubClient?: GitHubCommandClient;
888
+ githubPublicationClient?: GitHubPublicationClient;
889
+ };
890
+ type LocalReviewTaskLog = {
891
+ info(message: string): void;
892
+ warn(message: string): void;
893
+ error(message: string): void;
894
+ };
895
+ type LocalReviewCommandOptions = RuntimeCommandOptions & {
896
+ baseSha: string;
897
+ headSha?: string;
898
+ piExecutable?: string;
899
+ logSink?: ActionLogSink;
900
+ taskLog?: LocalReviewTaskLog;
901
+ };
902
+ type DryRunCommandResult = {
903
+ configSource: string;
904
+ event: ChangeRequestEventContext;
905
+ };
906
+ type InspectCommandResult = InspectRuntimePlan;
907
+ type LocalReviewCommandResult = ReviewRuntimeResult & {
908
+ kind: "review" | "skipped";
909
+ commandResponse?: never;
910
+ };
911
+ type PublishedReviewRuntimeResult = Extract<ReviewRuntimeResult, {
912
+ kind: "review";
913
+ }>;
914
+ type ActionCommandResult = {
915
+ kind: "ignored";
916
+ reason: string;
917
+ } | {
918
+ kind: "dry-run";
919
+ event: ChangeRequestEventContext;
920
+ configSource: string;
921
+ } | {
922
+ kind: "command-help";
923
+ event: ChangeRequestEventContext;
924
+ configSource: string;
925
+ body: string;
926
+ reason: string;
927
+ } | {
928
+ kind: "review";
929
+ event: ChangeRequestEventContext;
930
+ configSource: string;
931
+ command?: string;
932
+ review: PublishedReviewRuntimeResult;
933
+ publication: PublicationResult;
934
+ } | {
935
+ kind: "command-response";
936
+ event: ChangeRequestEventContext;
937
+ configSource: string;
938
+ command: string;
939
+ response: {
940
+ body: string;
941
+ };
942
+ publication: CommandResponsePublicationResult;
943
+ } | {
944
+ kind: "verifier";
945
+ event: ChangeRequestEventContext;
946
+ configSource: string;
947
+ errors: string[];
948
+ };
949
+ type ValidateCommandResult = RuntimeSettings;
950
+ //#endregion
951
+ //#region src/action/commands.d.ts
952
+ /** Initializes the official minimal `.pipr` project files. */
953
+ declare function runInitCommand(options: InitCommandOptions): Promise<InitOfficialMinimalProjectResult>;
954
+ /** Loads and validates the runtime project configuration. */
955
+ declare function runValidateCommand(options: RuntimeCommandOptions): Promise<ValidateCommandResult>;
956
+ /** Returns an inspectable summary of the configured runtime plan. */
957
+ declare function runInspectCommand(options: RuntimeCommandOptions): Promise<InspectCommandResult>;
958
+ /** Loads the runtime config and pull request event without running review publication. */
959
+ declare function runDryRunCommand(options: DryRunCommandOptions): Promise<DryRunCommandResult>;
960
+ /** Runs configured change-request tasks against local Git base and head revisions. */
961
+ declare function runLocalReviewCommand(options: LocalReviewCommandOptions): Promise<LocalReviewCommandResult>;
962
+ /** Runs the GitHub Action workflow for pull request and issue-comment events. */
963
+ declare function runActionCommand(options: ActionCommandOptions): Promise<ActionCommandResult>;
964
+ declare function runActionCommandWithDependencies(options: ActionCommandDependencyOptions): Promise<ActionCommandResult>;
965
+ //#endregion
966
+ export { OfficialInitAdapter as A, DiffManifest as C, RepositoryRef as D, ProviderConfig as E, RuntimeSettings as O, ChangeRequestRef as S, PlatformInfo as T, ActionLogSink as _, runInspectCommand as a, PublicationResult as b, ActionCommandOptions as c, DryRunCommandResult as d, InitCommandOptions as f, RuntimeCommandOptions as g, LocalReviewCommandResult as h, runInitCommand as i, supportedOfficialInitAdapters as j, InitTypeSupportMode as k, ActionCommandResult as l, LocalReviewCommandOptions as m, runActionCommandWithDependencies as n, runLocalReviewCommand as o, InspectCommandResult as p, runDryRunCommand as r, runValidateCommand as s, runActionCommand as t, DryRunCommandOptions as u, GitHubPublicationClient as v, PiprConfig as w, ChangeRequestEventContext as x, PublicationError as y };
967
+ //# sourceMappingURL=commands-C7OX2Jnd.d.mts.map