@wardby/cli 0.4.1 → 0.5.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.
Files changed (221) hide show
  1. package/.env.example +8 -1
  2. package/README.md +3 -1
  3. package/deploy/local/docker-compose.quickstart-coding.yml +27 -0
  4. package/dist/claude-coding-worker/driver.d.ts +2 -0
  5. package/dist/claude-coding-worker/driver.js +19 -3
  6. package/dist/claude-coding-worker/sdk.js +1 -1
  7. package/dist/cli.js +41 -22
  8. package/dist/coding/continuation-wording.d.ts +10 -0
  9. package/dist/coding/continuation-wording.js +13 -0
  10. package/dist/coding/docker-preflight.d.ts +12 -0
  11. package/dist/coding/docker-preflight.js +40 -0
  12. package/dist/coding/local-git.d.ts +22 -0
  13. package/dist/coding/local-git.js +102 -0
  14. package/dist/coding/local-repo-status.d.ts +7 -0
  15. package/dist/coding/local-repo-status.js +56 -0
  16. package/dist/coding/local-repo.d.ts +17 -0
  17. package/dist/coding/local-repo.js +65 -0
  18. package/dist/coding/observability.d.ts +1 -1
  19. package/dist/coding/observability.js +1 -0
  20. package/dist/coding/profile.d.ts +6 -0
  21. package/dist/coding/profile.js +13 -4
  22. package/dist/coding/protocol.d.ts +32 -7
  23. package/dist/coding/protocol.js +66 -4
  24. package/dist/coding-worker/artifact.d.ts +1 -0
  25. package/dist/coding-worker/errors.js +2 -0
  26. package/dist/config/providers.d.ts +13 -0
  27. package/dist/config/providers.js +21 -9
  28. package/dist/core/attribution.d.ts +13 -0
  29. package/dist/core/attribution.js +30 -0
  30. package/dist/core/budget-groups.d.ts +3 -1
  31. package/dist/core/budget-groups.js +53 -5
  32. package/dist/core/ci-context.d.ts +8 -0
  33. package/dist/core/ci-context.js +59 -0
  34. package/dist/core/delegation-siblings.d.ts +22 -0
  35. package/dist/core/delegation-siblings.js +40 -0
  36. package/dist/core/dispatch.d.ts +28 -4
  37. package/dist/core/dispatch.js +57 -15
  38. package/dist/core/engine-native.d.ts +16 -0
  39. package/dist/core/engine-native.js +49 -2
  40. package/dist/core/host-events.d.ts +25 -2
  41. package/dist/core/host-events.js +361 -19
  42. package/dist/core/host-status.d.ts +8 -3
  43. package/dist/core/host-status.js +38 -7
  44. package/dist/core/issue-events.d.ts +2 -6
  45. package/dist/core/issue-events.js +13 -19
  46. package/dist/core/pull-request-state-sync.d.ts +17 -0
  47. package/dist/core/pull-request-state-sync.js +53 -0
  48. package/dist/core/reconciler.d.ts +10 -1
  49. package/dist/core/reconciler.js +15 -2
  50. package/dist/core/related-pull-requests.d.ts +95 -0
  51. package/dist/core/related-pull-requests.js +338 -0
  52. package/dist/core/repo-access.d.ts +5 -1
  53. package/dist/core/repo-access.js +17 -1
  54. package/dist/core/review-fix-ledger.d.ts +20 -0
  55. package/dist/core/review-fix-ledger.js +41 -0
  56. package/dist/core/review-fix.d.ts +60 -0
  57. package/dist/core/review-fix.js +155 -0
  58. package/dist/core/review-host-tools.d.ts +13 -2
  59. package/dist/core/review-host-tools.js +72 -11
  60. package/dist/core/runner.d.ts +2 -2
  61. package/dist/core/runner.js +379 -184
  62. package/dist/core/serial-gate.d.ts +11 -0
  63. package/dist/core/serial-gate.js +19 -0
  64. package/dist/core/timing.d.ts +7 -0
  65. package/dist/core/timing.js +7 -0
  66. package/dist/generated/prisma/browser.d.ts +23 -0
  67. package/dist/generated/prisma/client.d.ts +23 -0
  68. package/dist/generated/prisma/commonInputTypes.d.ts +22 -0
  69. package/dist/generated/prisma/internal/class.d.ts +33 -0
  70. package/dist/generated/prisma/internal/class.js +4 -4
  71. package/dist/generated/prisma/internal/prismaNamespace.d.ts +274 -1
  72. package/dist/generated/prisma/internal/prismaNamespace.js +47 -2
  73. package/dist/generated/prisma/internal/prismaNamespaceBrowser.d.ts +48 -0
  74. package/dist/generated/prisma/internal/prismaNamespaceBrowser.js +47 -2
  75. package/dist/generated/prisma/models/Agent.d.ts +422 -1
  76. package/dist/generated/prisma/models/AgentRepository.d.ts +120 -2
  77. package/dist/generated/prisma/models/CodingAgentProfile.d.ts +42 -1
  78. package/dist/generated/prisma/models/CodingRun.d.ts +205 -1
  79. package/dist/generated/prisma/models/DeferredReview.d.ts +1336 -0
  80. package/dist/generated/prisma/models/DeferredReview.js +1 -0
  81. package/dist/generated/prisma/models/LocalPullRequest.d.ts +1384 -0
  82. package/dist/generated/prisma/models/LocalPullRequest.js +1 -0
  83. package/dist/generated/prisma/models/LocalReview.d.ts +1315 -0
  84. package/dist/generated/prisma/models/LocalReview.js +1 -0
  85. package/dist/generated/prisma/models/Run.d.ts +223 -0
  86. package/dist/generated/prisma/models/RunHostCheck.d.ts +148 -1
  87. package/dist/generated/prisma/models.d.ts +3 -0
  88. package/dist/help-index.json +486 -37
  89. package/dist/import/neutral-schema.d.ts +2 -2
  90. package/dist/mcp/auth/access.d.ts +3 -1
  91. package/dist/mcp/auth/host-account-cli.js +2 -2
  92. package/dist/mcp/auth/repo-authorization.d.ts +6 -7
  93. package/dist/mcp/auth/repo-authorization.js +21 -0
  94. package/dist/mcp/index.js +4 -1
  95. package/dist/mcp/tools/agents.js +46 -4
  96. package/dist/mcp/tools/host-accounts.js +2 -2
  97. package/dist/mcp/tools/repositories.js +71 -12
  98. package/dist/mcp/tools/runs.js +23 -0
  99. package/dist/mcp/tools/trigger.js +153 -24
  100. package/dist/providers/engine/types.d.ts +11 -0
  101. package/dist/providers/executor/composition.js +12 -7
  102. package/dist/providers/executor/container.d.ts +40 -3
  103. package/dist/providers/executor/container.js +140 -9
  104. package/dist/providers/executor/types.d.ts +1 -1
  105. package/dist/providers/jobs/fake-kubernetes-api.d.ts +3 -2
  106. package/dist/providers/jobs/fake-kubernetes-api.js +3 -0
  107. package/dist/providers/jobs/kubernetes-api.d.ts +3 -1
  108. package/dist/providers/jobs/kubernetes-client.d.ts +2 -1
  109. package/dist/providers/jobs/kubernetes-client.js +3 -0
  110. package/dist/providers/jobs/kubernetes-isolation.d.ts +7 -0
  111. package/dist/providers/jobs/kubernetes-isolation.js +8 -3
  112. package/dist/providers/jobs/kubernetes-preflight.d.ts +8 -0
  113. package/dist/providers/jobs/kubernetes-preflight.js +7 -0
  114. package/dist/providers/jobs/kubernetes-quota.d.ts +31 -0
  115. package/dist/providers/jobs/kubernetes-quota.js +110 -0
  116. package/dist/providers/jobs/kubernetes.d.ts +9 -0
  117. package/dist/providers/jobs/kubernetes.js +50 -0
  118. package/dist/providers/jobs/types.d.ts +7 -0
  119. package/dist/providers/review-host/ci.d.ts +7 -0
  120. package/dist/providers/review-host/ci.js +20 -0
  121. package/dist/providers/review-host/github-events.d.ts +7 -0
  122. package/dist/providers/review-host/github-events.js +31 -7
  123. package/dist/providers/review-host/github.d.ts +19 -2
  124. package/dist/providers/review-host/github.js +145 -2
  125. package/dist/providers/review-host/index.d.ts +8 -2
  126. package/dist/providers/review-host/index.js +14 -3
  127. package/dist/providers/review-host/local.d.ts +72 -0
  128. package/dist/providers/review-host/local.js +434 -0
  129. package/dist/providers/review-host/types.d.ts +65 -3
  130. package/dist/providers/review-host/types.js +5 -3
  131. package/dist/providers/vcs/git.d.ts +10 -20
  132. package/dist/providers/vcs/git.js +71 -127
  133. package/dist/providers/vcs/github-remote.d.ts +67 -0
  134. package/dist/providers/vcs/github-remote.js +201 -0
  135. package/dist/providers/vcs/github.d.ts +81 -0
  136. package/dist/providers/vcs/github.js +203 -6
  137. package/dist/providers/vcs/index.d.ts +16 -1
  138. package/dist/providers/vcs/index.js +43 -15
  139. package/dist/providers/vcs/local-remote.d.ts +44 -0
  140. package/dist/providers/vcs/local-remote.js +108 -0
  141. package/dist/providers/vcs/remote.d.ts +58 -0
  142. package/dist/providers/vcs/remote.js +1 -0
  143. package/dist/providers/vcs/routing.d.ts +33 -0
  144. package/dist/providers/vcs/routing.js +52 -0
  145. package/dist/providers/vcs/types.d.ts +12 -1
  146. package/dist/quickstart/coding-db.d.ts +11 -0
  147. package/dist/quickstart/coding-db.js +75 -0
  148. package/dist/quickstart/coding-doctor.d.ts +13 -0
  149. package/dist/quickstart/coding-doctor.js +88 -0
  150. package/dist/quickstart/coding-images.d.ts +15 -0
  151. package/dist/quickstart/coding-images.js +79 -0
  152. package/dist/quickstart/coding-seed.d.ts +63 -0
  153. package/dist/quickstart/coding-seed.js +85 -0
  154. package/dist/quickstart/coding.d.ts +66 -0
  155. package/dist/quickstart/coding.js +430 -0
  156. package/dist/quickstart/images.d.ts +19 -0
  157. package/dist/quickstart/images.js +63 -0
  158. package/dist/quickstart/index.js +61 -12
  159. package/dist/quickstart/starter-services.d.ts +45 -0
  160. package/dist/quickstart/starter-services.js +186 -0
  161. package/dist/quickstart-images.json +1 -0
  162. package/dist/serve.js +14 -1
  163. package/dist/viewer/api-schema.d.ts +176 -0
  164. package/dist/viewer/api-schema.js +27 -2
  165. package/dist/viewer/graph.d.ts +7 -2
  166. package/dist/viewer/graph.js +25 -11
  167. package/dist/viewer/http.d.ts +7 -1
  168. package/dist/viewer/http.js +8 -3
  169. package/dist/viewer/infra.d.ts +2 -0
  170. package/dist/viewer/infra.js +23 -0
  171. package/dist/viewer/run-detail.d.ts +2 -1
  172. package/dist/viewer/run-detail.js +2 -2
  173. package/docs/agent-recipes.md +127 -5
  174. package/docs/code-review-agents.md +293 -38
  175. package/docs/coding-agent-setup.md +141 -2
  176. package/docs/coding-packages.md +21 -0
  177. package/docs/coding-services.md +3 -0
  178. package/docs/coding-worker-isolation.md +56 -20
  179. package/docs/getting-started-gke.md +24 -0
  180. package/docs/getting-started.md +196 -10
  181. package/docs/jira-agents.md +26 -5
  182. package/docs/security-deployment.md +9 -0
  183. package/docs/viewer-api.md +21 -2
  184. package/help/admin-viewer.md +11 -1
  185. package/help/agent-recipes.md +30 -4
  186. package/help/builder-agent.md +4 -0
  187. package/help/code-review-agents.md +82 -2
  188. package/help/coding-packages.md +12 -1
  189. package/help/coding-services.md +4 -0
  190. package/help/cost-attribution.md +3 -1
  191. package/help/creating-agents.md +3 -0
  192. package/help/deploy-gke.md +2 -1
  193. package/help/errors/coding-provider-not-configured.md +60 -0
  194. package/help/errors/coding-turn-limit.md +25 -0
  195. package/help/errors/continuation-closed.md +75 -0
  196. package/help/errors/local-branch-conflict.md +37 -0
  197. package/help/errors/local-path-invalid.md +30 -0
  198. package/help/errors/local-ref-invalid.md +36 -0
  199. package/help/errors/local-ref-not-found.md +41 -0
  200. package/help/errors/local-repo-not-allowed.md +46 -0
  201. package/help/errors/local-repo-not-found.md +39 -0
  202. package/help/errors/model-unavailable.md +7 -6
  203. package/help/errors/vcs-github-not-configured.md +34 -0
  204. package/help/getting-started.md +28 -0
  205. package/help/github.md +22 -5
  206. package/help/jira.md +9 -2
  207. package/help/local-repositories.md +182 -0
  208. package/help/related-pull-requests.md +89 -0
  209. package/help/review-fix-rounds.md +69 -0
  210. package/help/troubleshooting/budgets.md +11 -0
  211. package/help/troubleshooting/coding-workers.md +22 -0
  212. package/help/troubleshooting/repository-access.md +5 -0
  213. package/package.json +3 -2
  214. package/prisma/migrations/20261004100000_delegations_and_coding_turns/migration.sql +12 -0
  215. package/prisma/migrations/20261005000000_review_fix_rounds/migration.sql +5 -0
  216. package/prisma/migrations/20261006000000_parallel_delegations/migration.sql +6 -0
  217. package/prisma/migrations/20261007000000_ci_rereview/migration.sql +4 -0
  218. package/prisma/migrations/20261008000000_review_after_ci/migration.sql +33 -0
  219. package/prisma/migrations/20261009000001_coding_run_local_branch/migration.sql +7 -0
  220. package/prisma/migrations/20261009000002_local_review/migration.sql +50 -0
  221. package/prisma/schema.prisma +98 -1
@@ -0,0 +1,50 @@
1
+ -- Additive: manual reviews of local repositories. A LocalPullRequest is a
2
+ -- branch compared against a base in a local: repository, keyed by a durable
3
+ -- serial number so the repo_* review tools address it like a pull request;
4
+ -- LocalReview holds what review agents publish on it.
5
+
6
+ -- CreateTable
7
+ CREATE TABLE "LocalPullRequest" (
8
+ "id" TEXT NOT NULL,
9
+ "number" SERIAL NOT NULL,
10
+ "repository" TEXT NOT NULL,
11
+ "branch" TEXT NOT NULL,
12
+ "base" TEXT NOT NULL,
13
+ "runId" TEXT,
14
+ "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
15
+
16
+ CONSTRAINT "LocalPullRequest_pkey" PRIMARY KEY ("id")
17
+ );
18
+
19
+ -- CreateTable
20
+ CREATE TABLE "LocalReview" (
21
+ "id" TEXT NOT NULL,
22
+ "pullRequestId" TEXT NOT NULL,
23
+ "agentId" TEXT NOT NULL,
24
+ "headSha" TEXT NOT NULL,
25
+ "verdict" TEXT NOT NULL,
26
+ "summary" TEXT NOT NULL,
27
+ "body" TEXT NOT NULL,
28
+ "comments" JSONB NOT NULL,
29
+ "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
30
+
31
+ CONSTRAINT "LocalReview_pkey" PRIMARY KEY ("id")
32
+ );
33
+
34
+ -- CreateIndex
35
+ CREATE UNIQUE INDEX "LocalPullRequest_number_key" ON "LocalPullRequest"("number");
36
+
37
+ -- CreateIndex
38
+ CREATE UNIQUE INDEX "LocalPullRequest_runId_key" ON "LocalPullRequest"("runId");
39
+
40
+ -- CreateIndex
41
+ CREATE INDEX "LocalPullRequest_repository_branch_idx" ON "LocalPullRequest"("repository", "branch");
42
+
43
+ -- CreateIndex
44
+ CREATE INDEX "LocalReview_pullRequestId_createdAt_idx" ON "LocalReview"("pullRequestId", "createdAt");
45
+
46
+ -- AddForeignKey
47
+ ALTER TABLE "LocalPullRequest" ADD CONSTRAINT "LocalPullRequest_runId_fkey" FOREIGN KEY ("runId") REFERENCES "Run"("id") ON DELETE SET NULL ON UPDATE CASCADE;
48
+
49
+ -- AddForeignKey
50
+ ALTER TABLE "LocalReview" ADD CONSTRAINT "LocalReview_pullRequestId_fkey" FOREIGN KEY ("pullRequestId") REFERENCES "LocalPullRequest"("id") ON DELETE CASCADE ON UPDATE CASCADE;
@@ -41,6 +41,10 @@ model Agent {
41
41
  // Phase 3: tools + multi-turn loop.
42
42
  tools AgentTool[]
43
43
  maxTurns Int @default(10)
44
+ /// Sub-agent delegations one run may make (delegate_to_*), each to a different sub-agent. 1 = route to exactly one.
45
+ maxDelegationsPerRun Int @default(1)
46
+ /// Native leads: the delegate_to_* calls of one model turn run at the same time. False = one after another.
47
+ parallelDelegations Boolean @default(false)
44
48
 
45
49
  // Phase 4: ownership. Null = owner-less, a transition state only: access
46
50
  // then comes from ResourceGrant rows alone (the migration gives everyone
@@ -52,6 +56,7 @@ model Agent {
52
56
  datastores AgentDatastore[]
53
57
  webhooks Webhook[]
54
58
  repositories AgentRepository[]
59
+ deferredReviews DeferredReview[]
55
60
  issueProjects AgentIssueProject[]
56
61
 
57
62
  /// Self-defects opt-in: the Jira project and issue type wardby files the agent's own failures into. Both or neither.
@@ -350,6 +355,8 @@ model Run {
350
355
  attribution RunAttribution?
351
356
  modelUsage RunModelUsage[]
352
357
  serviceStatuses CodingRunServiceStatus[]
358
+ /// A manual review of a local branch: this run is the review run dispatched for it.
359
+ localPullRequest LocalPullRequest?
353
360
 
354
361
  /// Un-phased: sub-agent dispatch (see AgentSubAgent). Null for a
355
362
  /// top-level run; set when this run was created by a parent run's
@@ -398,6 +405,8 @@ model CodingAgentProfile {
398
405
  defaultTask String?
399
406
  allowWebhookTaskOverride Boolean @default(false)
400
407
  timeoutSec Int @default(1800)
408
+ /// Claude Code runs only: the most agent turns a run may take. Null = the worker default (200).
409
+ maxTurns Int?
401
410
  /// Unused; dropped after rollout (see the package-registry plan, Task 14).
402
411
  allowedEgress Json @default("[]")
403
412
  protectedPaths Json
@@ -464,6 +473,8 @@ model CodingRun {
464
473
  /// Fixed at dispatch from the profile's debugTraceUntil: the worker writes a
465
474
  /// full stream trace to its own pod log (never to the database).
466
475
  debugTrace Boolean @default(false)
476
+ /// Fixed at dispatch from the profile's maxTurns: the Claude Code worker's turn limit. Null = the worker default.
477
+ maxTurns Int?
467
478
  /// Coding-run services resolved at dispatch from the base branch's
468
479
  /// .wardby/services.yaml: one snapshot per service (the catalog entry minus
469
480
  /// kind), fixed for the run's lifetime. Empty = none.
@@ -471,6 +482,10 @@ model CodingRun {
471
482
  /// The originating tracker issue ("jira" + key), set by the control plane from the run tree, never from model output.
472
483
  issueProvider String?
473
484
  issueKey String?
485
+ /// The branch a run pushed to a local repository (no pull request exists); null otherwise.
486
+ resultBranch String?
487
+ /// The commit the run started from (the base ref's tip when the workspace was prepared).
488
+ baseSha String?
474
489
  createdAt DateTime @default(now())
475
490
  updatedAt DateTime @updatedAt
476
491
  proxySession CodingProxySession?
@@ -1059,11 +1074,19 @@ model AgentRepository {
1059
1074
  repository String
1060
1075
  /// "read" or "write".
1061
1076
  access String
1062
- /// Subset of "pull_request", "mention", "push".
1077
+ /// Subset of "pull_request", "mention", "push", "review_fix".
1063
1078
  triggers String[] @default([])
1064
1079
  /// Only with the "pull_request" trigger (required there); names the agent's
1065
1080
  /// check. Unique per repository across all links (NULLs are distinct).
1066
1081
  checkName String?
1082
+ /// Only with the "review_fix" trigger: how many automatic fix rounds a
1083
+ /// pull request gets before wardby stops. Null = the default (2).
1084
+ reviewFixMaxRounds Int?
1085
+ /// Only with the "pull_request" trigger: holds this agent's review on a
1086
+ /// pushed head until that head's own CI finishes (see DeferredReview),
1087
+ /// instead of racing it. Default off: existing links review immediately,
1088
+ /// exactly as today.
1089
+ waitForCi Boolean @default(false)
1067
1090
  createdAt DateTime @default(now())
1068
1091
 
1069
1092
  /// How this link was authorized: "host_permission" (the agent owner's
@@ -1080,6 +1103,31 @@ model AgentRepository {
1080
1103
  @@index([provider, repository])
1081
1104
  }
1082
1105
 
1106
+ /// A pull-request review deferred because its head's CI was still pending
1107
+ /// (or had not reported) when the triggering push event arrived
1108
+ /// (AgentRepository.waitForCi). Started either when that head's CI finishes
1109
+ /// (the ci_completed host event) or by the reconciler's fallback sweep after
1110
+ /// DEFERRED_REVIEW_MAX_WAIT_MS. Idempotent per
1111
+ /// (provider, repository, prNumber, headSha, agentId): re-deferring the same
1112
+ /// head for the same agent is a no-op, not a duplicate row.
1113
+ model DeferredReview {
1114
+ id String @id @default(cuid())
1115
+ provider String
1116
+ repository String
1117
+ prNumber Int
1118
+ headSha String
1119
+ agentId String
1120
+ agent Agent @relation(fields: [agentId], references: [id], onDelete: Cascade)
1121
+ /// The agent's check name at defer time, so the delayed review starts
1122
+ /// against the same check even if the link's checkName changes later.
1123
+ checkName String
1124
+ createdAt DateTime @default(now())
1125
+
1126
+ @@unique([provider, repository, prNumber, headSha, agentId])
1127
+ @@index([provider, repository, headSha])
1128
+ @@index([createdAt])
1129
+ }
1130
+
1083
1131
  /// The host check a run owns, so the review tool can complete it and the
1084
1132
  /// run finalizer can close it if the run ends without publishing.
1085
1133
  model RunHostCheck {
@@ -1094,6 +1142,18 @@ model RunHostCheck {
1094
1142
  /// existed: such a run publishes without a check.
1095
1143
  prNumber Int?
1096
1144
  completedAt DateTime?
1145
+ /// The verdict the run published on its own check ("APPROVE",
1146
+ /// "CHANGES_REQUESTED", "COMMENT"); null until then, or when the check was
1147
+ /// closed without one (superseded, or by the finalizer).
1148
+ verdict String?
1149
+ /// The published review's summary and body (capped), kept for an automatic
1150
+ /// fix round started when the run finishes.
1151
+ reviewBody String?
1152
+ /// The run published COMMENT while CI on its head was still running or had
1153
+ /// not reported yet. CI finishing on that head later re-runs the review.
1154
+ ciPendingAtReview Boolean?
1155
+ /// When CI finishing on this head re-ran the review: at most once per head.
1156
+ ciRereviewAt DateTime?
1097
1157
  }
1098
1158
 
1099
1159
  /// De-duplicates host webhook redeliveries; pruned after 7 days.
@@ -1371,3 +1431,40 @@ model ModelCatalogEntry {
1371
1431
 
1372
1432
  @@id([provider, modelId])
1373
1433
  }
1434
+
1435
+ /// A local "pull request": a branch compared against a base in a local:
1436
+ /// repository (git folder on the wardby host), keyed by a durable number so
1437
+ /// the repo_* review tools work against it like a GitHub pull request.
1438
+ model LocalPullRequest {
1439
+ id String @id @default(cuid())
1440
+ number Int @unique @default(autoincrement())
1441
+ /// "local:/abs/path"
1442
+ repository String
1443
+ branch String
1444
+ base String
1445
+ /// The review run dispatched for this pull request.
1446
+ runId String? @unique
1447
+ run Run? @relation(fields: [runId], references: [id], onDelete: SetNull)
1448
+ createdAt DateTime @default(now())
1449
+ reviews LocalReview[]
1450
+
1451
+ @@index([repository, branch])
1452
+ }
1453
+
1454
+ /// A review (or a plain comment, verdict COMMENT) published on a LocalPullRequest.
1455
+ model LocalReview {
1456
+ id String @id @default(cuid())
1457
+ pullRequestId String
1458
+ pullRequest LocalPullRequest @relation(fields: [pullRequestId], references: [id], onDelete: Cascade)
1459
+ agentId String
1460
+ headSha String
1461
+ /// APPROVE | CHANGES_REQUESTED | COMMENT
1462
+ verdict String
1463
+ summary String
1464
+ body String
1465
+ /// [{path, line, side, severity, body}]
1466
+ comments Json
1467
+ createdAt DateTime @default(now())
1468
+
1469
+ @@index([pullRequestId, createdAt])
1470
+ }