@usepipr/runtime 0.3.8 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,15 +1,15 @@
1
1
  # @usepipr/runtime
2
2
 
3
- `@usepipr/runtime` owns Pipr's config loading, Action and local command
3
+ `@usepipr/runtime` owns Pipr's config loading, hosted and local command
4
4
  execution, Diff Manifest creation, Pi execution, review validation, and
5
5
  publication planning.
6
6
 
7
- Most users should interact with this package through the `pipr` CLI or the
8
- GitHub Action. Repository configs should import from `@usepipr/sdk`.
7
+ Most users should interact with this package through the `pipr` CLI or a code
8
+ host integration. Repository configs should import from `@usepipr/sdk`.
9
9
 
10
- ## Technical Notes
10
+ ## Technical notes
11
11
 
12
- - The package root exports command APIs for init, Action runs, dry runs,
12
+ - The package root exports command APIs for init, hosted runs, dry runs,
13
13
  config checks, plan inspection, and local review.
14
14
  - `./runtime-tools-extension` is the static Pi runtime tools extension loaded
15
15
  during condensed Diff Manifest runs.
@@ -19,18 +19,18 @@ GitHub Action. Repository configs should import from `@usepipr/sdk`.
19
19
  eval package review scoring.
20
20
  - The build emits ESM and declaration files to `dist`.
21
21
 
22
- ## Source Map
22
+ ## Source map
23
23
 
24
24
  | Path | Responsibility |
25
25
  | --- | --- |
26
- | `src/action` | CLI and GitHub Action command orchestration |
26
+ | `src/host-run` | Provider-neutral hosted event orchestration |
27
27
  | `src/config` | `.pipr/config.ts` loading, init files, recipes, and SDK stubs |
28
28
  | `src/diff` | Diff Manifest parsing, projection, ranges, and path filters |
29
29
  | `src/pi` | Pi subprocess contract, runtime tools, and provider wiring |
30
30
  | `src/review` | Task execution, agent prompts, validation, comments, and publication plans |
31
- | `src/hosts` | Code host adapters for GitHub and local runs |
31
+ | `src/hosts` | Code host adapters and local-run integration |
32
32
 
33
- ## Local Checks
33
+ ## Local checks
34
34
 
35
35
  ```bash
36
36
  bun run --cwd packages/runtime test:config-init
@@ -41,7 +41,7 @@ bun run --cwd packages/runtime check
41
41
 
42
42
  ## Docs
43
43
 
44
- - [Runtime Guide](https://pipr.run/docs/guide/runtime)
45
- - [Comments and Findings](https://pipr.run/docs/guide/comments)
44
+ - [Runtime flow](https://pipr.run/docs/concepts/runtime)
45
+ - [Comments and findings](https://pipr.run/docs/concepts/comments)
46
46
  - [Architecture](https://pipr.run/docs/reference/architecture)
47
- - [Trust and Security](https://pipr.run/docs/guide/trust-security)
47
+ - [Trust and security](https://pipr.run/docs/concepts/trust-security)
@@ -1,13 +1,13 @@
1
+ import "@usepipr/sdk/internal";
1
2
  import { z } from "zod";
2
3
  import { CommentableRange, DiffManifest, ReviewFinding, ReviewResult, ReviewSide } from "@usepipr/sdk";
3
- import "@usepipr/sdk/internal";
4
4
  //#region src/config/init.d.ts
5
5
  type InitOfficialMinimalProjectResult = {
6
6
  configDir: string;
7
7
  created: string[];
8
8
  overwritten: string[];
9
9
  };
10
- declare const supportedOfficialInitAdapters: readonly ["github"];
10
+ declare const supportedOfficialInitAdapters: readonly ["github", "gitlab", "azure-devops", "bitbucket"];
11
11
  type OfficialInitAdapter = (typeof supportedOfficialInitAdapters)[number];
12
12
  //#endregion
13
13
  //#region src/types.d.ts
@@ -43,6 +43,7 @@ declare const piprConfigSchema: z.ZodObject<{
43
43
  }, z.core.$strict>>;
44
44
  publication: z.ZodObject<{
45
45
  maxInlineComments: z.ZodOptional<z.ZodNumber>;
46
+ maxStoredFindings: z.ZodDefault<z.ZodNumber>;
46
47
  autoResolve: z.ZodObject<{
47
48
  enabled: z.ZodBoolean;
48
49
  model: z.ZodOptional<z.ZodString>;
@@ -93,6 +94,7 @@ declare const runtimeSettingsSchema: z.ZodObject<{
93
94
  }, z.core.$strict>>;
94
95
  publication: z.ZodObject<{
95
96
  maxInlineComments: z.ZodOptional<z.ZodNumber>;
97
+ maxStoredFindings: z.ZodDefault<z.ZodNumber>;
96
98
  autoResolve: z.ZodObject<{
97
99
  enabled: z.ZodBoolean;
98
100
  model: z.ZodOptional<z.ZodString>;
@@ -133,6 +135,26 @@ declare const repositoryRefSchema: z.ZodObject<{
133
135
  slug: z.ZodString;
134
136
  url: z.ZodOptional<z.ZodString>;
135
137
  }, z.core.$strict>;
138
+ declare const codeHostCoordinatesSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
139
+ provider: z.ZodLiteral<"github">;
140
+ owner: z.ZodString;
141
+ repository: z.ZodString;
142
+ }, z.core.$strict>, z.ZodObject<{
143
+ provider: z.ZodLiteral<"gitlab">;
144
+ projectId: z.ZodString;
145
+ projectPath: z.ZodString;
146
+ }, z.core.$strict>, z.ZodObject<{
147
+ provider: z.ZodLiteral<"bitbucket">;
148
+ workspace: z.ZodString;
149
+ repository: z.ZodString;
150
+ repositoryUuid: z.ZodOptional<z.ZodString>;
151
+ }, z.core.$strict>, z.ZodObject<{
152
+ provider: z.ZodLiteral<"azure-devops">;
153
+ organization: z.ZodString;
154
+ project: z.ZodString;
155
+ projectId: z.ZodOptional<z.ZodString>;
156
+ repositoryId: z.ZodString;
157
+ }, z.core.$strict>], "provider">;
136
158
  declare const changeRequestRefSchema: z.ZodObject<{
137
159
  number: z.ZodNumber;
138
160
  title: z.ZodDefault<z.ZodString>;
@@ -160,6 +182,7 @@ declare const changeRequestRefSchema: z.ZodObject<{
160
182
  fork: z.ZodOptional<z.ZodBoolean>;
161
183
  }, z.core.$strict>;
162
184
  isFork: z.ZodOptional<z.ZodBoolean>;
185
+ isDraft: z.ZodOptional<z.ZodBoolean>;
163
186
  }, z.core.$strict>;
164
187
  declare const changeRequestEventContextSchema: z.ZodObject<{
165
188
  eventName: z.ZodString;
@@ -173,6 +196,26 @@ declare const changeRequestEventContextSchema: z.ZodObject<{
173
196
  slug: z.ZodString;
174
197
  url: z.ZodOptional<z.ZodString>;
175
198
  }, z.core.$strict>;
199
+ coordinates: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
200
+ provider: z.ZodLiteral<"github">;
201
+ owner: z.ZodString;
202
+ repository: z.ZodString;
203
+ }, z.core.$strict>, z.ZodObject<{
204
+ provider: z.ZodLiteral<"gitlab">;
205
+ projectId: z.ZodString;
206
+ projectPath: z.ZodString;
207
+ }, z.core.$strict>, z.ZodObject<{
208
+ provider: z.ZodLiteral<"bitbucket">;
209
+ workspace: z.ZodString;
210
+ repository: z.ZodString;
211
+ repositoryUuid: z.ZodOptional<z.ZodString>;
212
+ }, z.core.$strict>, z.ZodObject<{
213
+ provider: z.ZodLiteral<"azure-devops">;
214
+ organization: z.ZodString;
215
+ project: z.ZodString;
216
+ projectId: z.ZodOptional<z.ZodString>;
217
+ repositoryId: z.ZodString;
218
+ }, z.core.$strict>], "provider">>;
176
219
  change: z.ZodObject<{
177
220
  number: z.ZodNumber;
178
221
  title: z.ZodDefault<z.ZodString>;
@@ -200,6 +243,7 @@ declare const changeRequestEventContextSchema: z.ZodObject<{
200
243
  fork: z.ZodOptional<z.ZodBoolean>;
201
244
  }, z.core.$strict>;
202
245
  isFork: z.ZodOptional<z.ZodBoolean>;
246
+ isDraft: z.ZodOptional<z.ZodBoolean>;
203
247
  }, z.core.$strict>;
204
248
  workspace: z.ZodString;
205
249
  }, z.core.$strict>;
@@ -223,6 +267,7 @@ type PiprConfig = z.infer<typeof piprConfigSchema>;
223
267
  type RuntimeSettings = z.infer<typeof runtimeSettingsSchema>;
224
268
  type PlatformInfo = z.infer<typeof platformInfoSchema>;
225
269
  type RepositoryRef = z.infer<typeof repositoryRefSchema>;
270
+ type CodeHostCoordinates = z.infer<typeof codeHostCoordinatesSchema>;
226
271
  type ChangeRequestRef = z.infer<typeof changeRequestRefSchema>;
227
272
  type ChangeRequestEventContext = z.infer<typeof changeRequestEventContextSchema>;
228
273
  type ValidatedReview = z.infer<typeof validatedReviewSchema>;
@@ -288,6 +333,7 @@ declare const inlinePublicationItemSchema: z.ZodObject<{
288
333
  finding: import("@usepipr/sdk").ZodSchema<ReviewFinding>;
289
334
  range: z.ZodType<CommentableRange, unknown, z.core.$ZodTypeInternals<CommentableRange, unknown>>;
290
335
  path: z.ZodString;
336
+ previousPath: z.ZodOptional<z.ZodString>;
291
337
  side: z.ZodType<ReviewSide, unknown, z.core.$ZodTypeInternals<ReviewSide, unknown>>;
292
338
  startLine: z.ZodNumber;
293
339
  endLine: z.ZodNumber;
@@ -305,7 +351,7 @@ declare const threadActionSchema: z.ZodObject<{
305
351
  }>;
306
352
  findingId: z.ZodString;
307
353
  findingHeadSha: z.ZodString;
308
- commentId: z.ZodNumber;
354
+ commentId: z.ZodString;
309
355
  threadId: z.ZodOptional<z.ZodString>;
310
356
  body: z.ZodString;
311
357
  responseKey: z.ZodString;
@@ -346,6 +392,7 @@ declare const publicationPlanSchema: z.ZodObject<{
346
392
  finding: import("@usepipr/sdk").ZodSchema<ReviewFinding>;
347
393
  range: z.ZodType<CommentableRange, unknown, z.core.$ZodTypeInternals<CommentableRange, unknown>>;
348
394
  path: z.ZodString;
395
+ previousPath: z.ZodOptional<z.ZodString>;
349
396
  side: z.ZodType<ReviewSide, unknown, z.core.$ZodTypeInternals<ReviewSide, unknown>>;
350
397
  startLine: z.ZodNumber;
351
398
  endLine: z.ZodNumber;
@@ -420,7 +467,7 @@ declare const publicationPlanSchema: z.ZodObject<{
420
467
  }>;
421
468
  findingId: z.ZodString;
422
469
  findingHeadSha: z.ZodString;
423
- commentId: z.ZodNumber;
470
+ commentId: z.ZodString;
424
471
  threadId: z.ZodOptional<z.ZodString>;
425
472
  body: z.ZodString;
426
473
  responseKey: z.ZodString;
@@ -432,7 +479,7 @@ type PublicationPlan = z.infer<typeof publicationPlanSchema>;
432
479
  type PublicationResult = {
433
480
  mainComment: {
434
481
  action: "created" | "updated";
435
- id: number;
482
+ id: string;
436
483
  };
437
484
  inlineComments: {
438
485
  posted: number;
@@ -452,17 +499,18 @@ declare class PublicationError extends Error {
452
499
  //#endregion
453
500
  //#region src/hosts/types.d.ts
454
501
  type HostEventParseOptions = {
455
- eventPath: string;
502
+ eventPath?: string;
456
503
  env: NodeJS.ProcessEnv;
457
504
  workspace: string;
458
505
  };
506
+ type NativeId = string;
459
507
  type CommandCommentEvent = {
460
508
  eventName: string;
461
509
  action?: string;
462
510
  rawAction?: string;
463
511
  repository: RepositoryRef;
464
512
  changeNumber: number;
465
- commentId: number;
513
+ commentId: NativeId;
466
514
  isChangeRequest: boolean;
467
515
  body: string;
468
516
  actor: string;
@@ -470,17 +518,17 @@ type CommandCommentEvent = {
470
518
  };
471
519
  type CommandResponsePublicationResult = {
472
520
  action: "created" | "updated";
473
- id: number;
521
+ id: NativeId;
474
522
  };
475
523
  type InlineThreadContext = {
476
524
  findingId: string;
477
525
  findingHeadSha: string;
478
- parentCommentId: number;
526
+ parentCommentId: NativeId;
479
527
  parentBody: string;
480
528
  threadId?: string;
481
529
  threadResolved: boolean;
482
530
  comments: Array<{
483
- id: number;
531
+ id: NativeId;
484
532
  body: string;
485
533
  authorLogin?: string;
486
534
  }>;
@@ -491,14 +539,28 @@ type ReviewCommentReplyEvent = {
491
539
  rawAction?: string;
492
540
  repository: RepositoryRef;
493
541
  changeNumber: number;
494
- commentId: number;
495
- parentCommentId?: number;
542
+ commentId: NativeId;
543
+ parentCommentId?: NativeId;
496
544
  body: string;
497
545
  actor: string;
498
546
  workspace: string;
499
547
  };
548
+ type CodeHostEvent = {
549
+ kind: "ignored";
550
+ reason: string;
551
+ } | {
552
+ kind: "change-request";
553
+ change: ChangeRequestEventContext;
554
+ } | {
555
+ kind: "command-comment";
556
+ comment: CommandCommentEvent;
557
+ } | {
558
+ kind: "review-comment-reply";
559
+ reply: ReviewCommentReplyEvent;
560
+ };
500
561
  type LoadedChangeRequest = {
501
562
  repository: RepositoryRef;
563
+ coordinates: CodeHostCoordinates;
502
564
  change: ChangeRequestRef;
503
565
  eventName?: string;
504
566
  action?: string;
@@ -506,13 +568,13 @@ type LoadedChangeRequest = {
506
568
  workspace?: string;
507
569
  };
508
570
  type RepositoryPermission = CommandPermissionLevel | "none";
509
- type CodeHostCheckConclusion = "success" | "failure" | "neutral";
510
- type CodeHostCheckRun = {
511
- id: number | string;
571
+ type CodeHostStatusState = "pending" | "success" | "failure" | "neutral";
572
+ type CodeHostStatus = {
573
+ id: NativeId;
512
574
  name: string;
513
575
  };
514
576
  type CodeHostEvents = {
515
- parseEvent(options: HostEventParseOptions): Promise<ChangeRequestEventContext>;
577
+ parseEvent(options: HostEventParseOptions): Promise<CodeHostEvent>;
516
578
  loadChangeRequest(ref: {
517
579
  repository: RepositoryRef;
518
580
  changeNumber: number;
@@ -521,12 +583,10 @@ type CodeHostEvents = {
521
583
  action?: string;
522
584
  rawAction?: string;
523
585
  }): Promise<LoadedChangeRequest>;
524
- resolveCommandComment(options: HostEventParseOptions): Promise<CommandCommentEvent>;
525
- resolveReviewCommentReply?(options: HostEventParseOptions): Promise<ReviewCommentReplyEvent>;
526
586
  };
527
587
  type CodeHostPermissions = {
528
588
  getRepositoryPermission(options: {
529
- repository: RepositoryRef;
589
+ change: ChangeRequestEventContext;
530
590
  actor: string;
531
591
  }): Promise<RepositoryPermission>;
532
592
  };
@@ -534,7 +594,7 @@ type CodeHostWorkspace = {
534
594
  ensureHeadCheckout(options: {
535
595
  rootDir: string;
536
596
  change: ChangeRequestEventContext;
537
- }): void;
597
+ }): Promise<void>;
538
598
  ensureWorkspaceSafeDirectory?(options: {
539
599
  rootDir: string;
540
600
  env?: NodeJS.ProcessEnv;
@@ -547,7 +607,7 @@ type CodeHostPublication = {
547
607
  }): Promise<PublicationResult>;
548
608
  publishCommandResponse?(options: {
549
609
  change: ChangeRequestEventContext;
550
- sourceCommentId: number;
610
+ sourceCommentId: NativeId;
551
611
  commandName: string;
552
612
  body: string;
553
613
  }): Promise<CommandResponsePublicationResult>;
@@ -570,206 +630,59 @@ type CodeHostComments = {
570
630
  change: ChangeRequestEventContext;
571
631
  }): Promise<InlineThreadContext[]>;
572
632
  };
573
- type CodeHostChecks = {
574
- createCheckRun?(options: {
633
+ type CodeHostStatuses = {
634
+ isAvailable(change: ChangeRequestEventContext): boolean;
635
+ upsert(options: {
575
636
  change: ChangeRequestEventContext;
576
637
  name: string;
638
+ state: CodeHostStatusState;
577
639
  summary?: string;
578
- }): Promise<CodeHostCheckRun>;
579
- updateCheckRun?(options: {
580
- change: ChangeRequestEventContext;
581
- checkRun: CodeHostCheckRun;
582
- conclusion: CodeHostCheckConclusion;
583
- summary?: string;
584
- }): Promise<void>;
640
+ status?: CodeHostStatus;
641
+ }): Promise<CodeHostStatus>;
642
+ };
643
+ type CodeHostCapabilities = {
644
+ commandComments: boolean;
645
+ reviewCommentReplies: boolean;
646
+ threadResolution: boolean;
647
+ multilineInlineComments: boolean;
648
+ suggestedChanges: boolean;
649
+ statuses: boolean;
585
650
  };
586
651
  type CodeHostAdapter = {
587
652
  id: string;
653
+ capabilities: CodeHostCapabilities;
588
654
  events: CodeHostEvents;
589
655
  workspace: CodeHostWorkspace;
590
656
  permissions: CodeHostPermissions;
591
657
  publication?: CodeHostPublication;
592
658
  comments?: CodeHostComments;
593
- checks?: CodeHostChecks;
594
- };
595
- //#endregion
596
- //#region src/hosts/github/command.d.ts
597
- type GitHubPullRequestDetails = {
598
- repository: RepositoryRef;
599
- change: ChangeRequestRef;
600
- };
601
- type GitHubCommandClient = {
602
- getPullRequest(options: {
603
- repository: RepositoryRef;
604
- changeNumber: number;
605
- }): Promise<GitHubPullRequestDetails>;
606
- getRepositoryPermission(options: {
607
- repository: RepositoryRef;
608
- actor: string;
609
- }): Promise<RepositoryPermission>;
610
- };
611
- //#endregion
612
- //#region src/hosts/github/publication-client.d.ts
613
- declare const githubIssueCommentSchema: z.ZodPipe<z.ZodObject<{
614
- id: z.ZodNumber;
615
- body: z.ZodOptional<z.ZodNullable<z.ZodString>>;
616
- user: z.ZodOptional<z.ZodObject<{
617
- login: z.ZodString;
618
- }, z.core.$loose>>;
619
- }, z.core.$loose>, z.ZodTransform<{
620
- id: number;
621
- body: string | null | undefined;
622
- authorLogin: string | undefined;
623
- }, {
624
- [x: string]: unknown;
625
- id: number;
626
- body?: string | null | undefined;
627
- user?: {
628
- [x: string]: unknown;
629
- login: string;
630
- } | undefined;
631
- }>>;
632
- declare const githubReviewCommentSchema: z.ZodPipe<z.ZodObject<{
633
- path: z.ZodOptional<z.ZodString>;
634
- commit_id: z.ZodOptional<z.ZodString>;
635
- line: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
636
- start_line: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
637
- side: z.ZodOptional<z.ZodEnum<{
638
- RIGHT: "RIGHT";
639
- LEFT: "LEFT";
640
- }>>;
641
- start_side: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
642
- RIGHT: "RIGHT";
643
- LEFT: "LEFT";
644
- }>>>;
645
- user: z.ZodOptional<z.ZodObject<{
646
- login: z.ZodString;
647
- }, z.core.$loose>>;
648
- id: z.ZodNumber;
649
- body: z.ZodOptional<z.ZodNullable<z.ZodString>>;
650
- }, z.core.$loose>, z.ZodTransform<{
651
- id: number;
652
- body: string | null | undefined;
653
- authorLogin: string | undefined;
654
- path: string | undefined;
655
- commitId: string | undefined;
656
- line: number | undefined;
657
- startLine: number | undefined;
658
- side: "RIGHT" | "LEFT" | undefined;
659
- startSide: "RIGHT" | "LEFT" | undefined;
660
- }, {
661
- [x: string]: unknown;
662
- id: number;
663
- path?: string | undefined;
664
- commit_id?: string | undefined;
665
- line?: number | null | undefined;
666
- start_line?: number | null | undefined;
667
- side?: "RIGHT" | "LEFT" | undefined;
668
- start_side?: "RIGHT" | "LEFT" | null | undefined;
669
- user?: {
670
- [x: string]: unknown;
671
- login: string;
672
- } | undefined;
673
- body?: string | null | undefined;
674
- }>>;
675
- declare const githubReviewThreadSchema: z.ZodObject<{
676
- id: z.ZodString;
677
- isResolved: z.ZodBoolean;
678
- commentIds: z.ZodArray<z.ZodNumber>;
679
- }, z.core.$strict>;
680
- declare const githubCheckRunSchema: z.ZodObject<{
681
- id: z.ZodNumber;
682
- name: z.ZodString;
683
- }, z.core.$loose>;
684
- type GitHubIssueComment = z.infer<typeof githubIssueCommentSchema>;
685
- type GitHubReviewComment = z.infer<typeof githubReviewCommentSchema>;
686
- type GitHubReviewThread = z.infer<typeof githubReviewThreadSchema>;
687
- type GitHubCheckRun = z.infer<typeof githubCheckRunSchema>;
688
- type GitHubPublicationClient = {
689
- getAuthenticatedUserLogin(): Promise<string>;
690
- getPullRequestHeadSha(options: {
691
- repo: string;
692
- pullRequestNumber: number;
693
- }): Promise<string>;
694
- listIssueComments(options: {
695
- repo: string;
696
- issueNumber: number;
697
- }): Promise<GitHubIssueComment[]>;
698
- createIssueComment(options: {
699
- repo: string;
700
- issueNumber: number;
701
- body: string;
702
- }): Promise<{
703
- id: number;
704
- }>;
705
- updateIssueComment(options: {
706
- repo: string;
707
- commentId: number;
708
- body: string;
709
- }): Promise<{
710
- id: number;
711
- }>;
712
- listReviewComments(options: {
713
- repo: string;
714
- pullRequestNumber: number;
715
- }): Promise<GitHubReviewComment[]>;
716
- listReviewThreads(options: {
717
- repo: string;
718
- pullRequestNumber: number;
719
- }): Promise<GitHubReviewThread[]>;
720
- createReviewComment(options: {
721
- repo: string;
722
- pullRequestNumber: number;
723
- body: string;
724
- path: string;
725
- commit_id: string;
726
- line: number;
727
- side: "RIGHT" | "LEFT";
728
- start_line?: number;
729
- start_side?: "RIGHT" | "LEFT";
730
- }): Promise<{
731
- id: number;
732
- }>;
733
- createReviewCommentReply(options: {
734
- repo: string;
735
- pullRequestNumber: number;
736
- commentId: number;
737
- body: string;
738
- }): Promise<{
739
- id: number;
740
- }>;
741
- resolveReviewThread(options: {
742
- threadId: string;
743
- }): Promise<void>;
744
- createCheckRun(options: {
745
- repo: string;
746
- name: string;
747
- headSha: string;
748
- summary?: string;
749
- }): Promise<GitHubCheckRun>;
750
- updateCheckRun(options: {
751
- repo: string;
752
- checkRunId: number;
753
- name: string;
754
- conclusion: "success" | "failure" | "neutral";
755
- summary?: string;
756
- }): Promise<void>;
659
+ statuses?: CodeHostStatuses;
757
660
  };
758
661
  //#endregion
759
662
  //#region src/shared/logging.d.ts
760
- type ActionLogSink = {
761
- log(record: ActionLogRecord): void;
663
+ type RuntimeLogSink = {
664
+ log(record: RuntimeLogRecord): void;
762
665
  group<T>(name: string, run: () => Promise<T>): Promise<T>;
763
666
  };
764
- type ActionLogRecord = {
667
+ type RuntimeLogRecord = {
765
668
  level: LogLevel;
766
669
  event: string;
767
- fields: ActionLogRecordFields;
670
+ fields: RuntimeLogRecordFields;
768
671
  text?: string;
769
672
  };
770
- type ActionLogRecordFields = Record<string, string | number | boolean | readonly string[]>;
673
+ type RuntimeLogRecordFields = Record<string, string | number | boolean | readonly string[]>;
771
674
  type LogLevel = "info" | "notice" | "warning" | "error" | "debug";
772
675
  //#endregion
676
+ //#region src/shared/secret-redaction.d.ts
677
+ type SecretRedactionResult = {
678
+ value: string;
679
+ detected: boolean;
680
+ };
681
+ type SecretRedactor = {
682
+ addSecret(value: string | undefined): void;
683
+ redact(value: string): SecretRedactionResult;
684
+ };
685
+ //#endregion
773
686
  //#region src/pi/contract.d.ts
774
687
  declare const piThinkingLevels: readonly ["off", "minimal", "low", "medium", "high", "xhigh"];
775
688
  declare const piBuiltinToolNames: readonly ["read", "bash", "edit", "write", "grep", "find", "ls"];
@@ -823,7 +736,7 @@ type ReviewRuntimeResult = (ReviewRuntimeBaseResult & {
823
736
  inlineCommentDrafts?: never;
824
737
  });
825
738
  //#endregion
826
- //#region src/action/types.d.ts
739
+ //#region src/host-run/types.d.ts
827
740
  type RuntimeCommandOptions = {
828
741
  rootDir: string;
829
742
  configDir: string;
@@ -837,18 +750,19 @@ type InitCommandOptions = RuntimeCommandOptions & {
837
750
  minimal?: boolean;
838
751
  };
839
752
  type DryRunCommandOptions = RuntimeCommandOptions & {
753
+ host?: string;
840
754
  eventPath: string;
841
755
  };
842
- type ActionCommandOptions = RuntimeCommandOptions & {
843
- eventPath: string;
756
+ type HostRunCommandOptions = RuntimeCommandOptions & {
757
+ host?: string;
758
+ eventPath?: string;
844
759
  dryRun: boolean;
845
- logSink?: ActionLogSink;
760
+ logSink?: RuntimeLogSink;
846
761
  };
847
- type ActionCommandDependencyOptions = ActionCommandOptions & {
762
+ type HostRunCommandDependencyOptions = HostRunCommandOptions & {
848
763
  piExecutable?: string;
849
764
  hostAdapter?: CodeHostAdapter;
850
- githubClient?: GitHubCommandClient;
851
- githubPublicationClient?: GitHubPublicationClient;
765
+ secretRedactor?: SecretRedactor;
852
766
  };
853
767
  type LocalReviewTaskLog = {
854
768
  info(message: string): void;
@@ -859,7 +773,7 @@ type LocalReviewCommandOptions = RuntimeCommandOptions & {
859
773
  baseSha: string;
860
774
  headSha?: string;
861
775
  piExecutable?: string;
862
- logSink?: ActionLogSink;
776
+ logSink?: RuntimeLogSink;
863
777
  taskLog?: LocalReviewTaskLog;
864
778
  };
865
779
  type DryRunCommandResult = {
@@ -877,7 +791,7 @@ type LocalReviewCommandResult = ReviewRuntimeResult & {
877
791
  type PublishedReviewRuntimeResult = Extract<ReviewRuntimeResult, {
878
792
  kind: "review";
879
793
  }>;
880
- type ActionCommandResult = {
794
+ type HostRunCommandResult = {
881
795
  kind: "ignored";
882
796
  reason: string;
883
797
  } | {
@@ -914,20 +828,20 @@ type ActionCommandResult = {
914
828
  };
915
829
  type ValidateCommandResult = RuntimeSettings;
916
830
  //#endregion
917
- //#region src/action/commands.d.ts
831
+ //#region src/host-run/commands.d.ts
918
832
  /** Initializes the official minimal `.pipr` project files. */
919
833
  declare function runInitCommand(options: InitCommandOptions): Promise<InitOfficialMinimalProjectResult>;
920
834
  /** Loads and validates the runtime project configuration. */
921
835
  declare function runValidateCommand(options: RuntimeCommandOptions): Promise<ValidateCommandResult>;
922
836
  /** Returns an inspectable summary of the configured runtime plan. */
923
837
  declare function runInspectCommand(options: RuntimeCommandOptions): Promise<InspectCommandResult>;
924
- /** Loads the runtime config and pull request event without running review publication. */
838
+ /** Loads the runtime config and change request event without running review publication. */
925
839
  declare function runDryRunCommand(options: DryRunCommandOptions): Promise<DryRunCommandResult>;
926
840
  /** Runs configured change-request tasks against local Git base and head revisions. */
927
841
  declare function runLocalReviewCommand(options: LocalReviewCommandOptions): Promise<LocalReviewCommandResult>;
928
- /** Runs the GitHub Action workflow for pull request and issue-comment events. */
929
- declare function runActionCommand(options: ActionCommandOptions): Promise<ActionCommandResult>;
930
- declare function runActionCommandWithDependencies(options: ActionCommandDependencyOptions): Promise<ActionCommandResult>;
842
+ /** Runs a normalized code host event through the selected adapter. */
843
+ declare function runHostRunCommand(options: HostRunCommandOptions): Promise<HostRunCommandResult>;
844
+ declare function runHostRunCommandWithDependencies(options: HostRunCommandDependencyOptions): Promise<HostRunCommandResult>;
931
845
  //#endregion
932
- export { PlatformInfo as A, GitHubPublicationClient as C, ChangeRequestRef as D, ChangeRequestEventContext as E, supportedOfficialInitAdapters as F, RepositoryRef as M, RuntimeSettings as N, DiffManifest as O, OfficialInitAdapter as P, ActionLogSink as S, PublicationResult as T, piBuiltinToolNames as _, runInspectCommand as a, piThinkingLevels as b, ActionCommandOptions as c, DryRunCommandResult as d, InitCommandOptions as f, RuntimeCommandOptions as g, LocalReviewCommandResult as h, runInitCommand as i, ProviderConfig as j, PiprConfig 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, piReadOnlyToolNames as v, PublicationError as w, ActionLogRecord as x, piRequiredCliFlags as y };
933
- //# sourceMappingURL=commands-C5_GHGxN.d.mts.map
846
+ export { DiffManifest as A, RuntimeLogSink as C, PublicationResult as D, PublicationError as E, RuntimeSettings as F, OfficialInitAdapter as I, supportedOfficialInitAdapters as L, PlatformInfo as M, ProviderConfig as N, ChangeRequestEventContext as O, RepositoryRef as P, RuntimeLogRecord as S, RepositoryPermission as T, piBuiltinToolNames as _, runInspectCommand as a, piThinkingLevels as b, DryRunCommandOptions as c, HostRunCommandResult as d, InitCommandOptions as f, RuntimeCommandOptions as g, LocalReviewCommandResult as h, runInitCommand as i, PiprConfig as j, ChangeRequestRef as k, DryRunCommandResult as l, LocalReviewCommandOptions as m, runHostRunCommand as n, runLocalReviewCommand as o, InspectCommandResult as p, runHostRunCommandWithDependencies as r, runValidateCommand as s, runDryRunCommand as t, HostRunCommandOptions as u, piReadOnlyToolNames as v, CodeHostAdapter as w, SecretRedactor as x, piRequiredCliFlags as y };
847
+ //# sourceMappingURL=commands-0cyQHxpm.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commands-0cyQHxpm.d.mts","names":[],"sources":["../src/config/init.ts","../src/types.ts","../src/config/project.ts","../src/review/prior-state.ts","../src/review/comment.ts","../src/review/publication-result.ts","../src/hosts/types.ts","../src/shared/logging.ts","../src/shared/secret-redaction.ts","../src/pi/contract.ts","../src/review/task/task-output.ts","../src/review/task/task-runtime.ts","../src/host-run/types.ts","../src/host-run/commands.ts"],"mappings":";;;;KAuBY;EACV;EACA;EACA;;cAGW;KAOD,8BAA8B;;;cCJpC,sBAAoB,EAAA;;;;;;;;;;;;;;cAyBpB,kBAAgB,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAwBhB,uBAAqB,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAMrB,oBAAkB,EAAA;;;;cAKlB,qBAAmB,EAAA;;;;cAKnB,2BAAyB,EAAA,uBAAA,EAAA;;;;;;;;;;;;;;;;;;;;cAkCzB,wBAAsB,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAYtB,iCAA+B,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAsE/B,uBAAqB,EAAA;;;;;;;;cAMrB,8BAA4B,EAAA;;;;;;;KAEtB,iBAAiB,EAAE,aAAa;KAGhC,aAAa,EAAE,aAAa;KAC5B,kBAAkB,EAAE,aAAa;KACjC,eAAe,EAA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