@wardby/cli 0.4.0 → 0.5.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.
- package/.env.example +8 -1
- package/README.md +3 -1
- package/deploy/local/docker-compose.quickstart-coding.yml +27 -0
- package/dist/claude-coding-worker/driver.d.ts +2 -0
- package/dist/claude-coding-worker/driver.js +19 -3
- package/dist/claude-coding-worker/sdk.js +1 -1
- package/dist/cli.js +41 -22
- package/dist/coding/continuation-wording.d.ts +10 -0
- package/dist/coding/continuation-wording.js +13 -0
- package/dist/coding/docker-preflight.d.ts +12 -0
- package/dist/coding/docker-preflight.js +40 -0
- package/dist/coding/local-git.d.ts +22 -0
- package/dist/coding/local-git.js +102 -0
- package/dist/coding/local-repo-status.d.ts +7 -0
- package/dist/coding/local-repo-status.js +56 -0
- package/dist/coding/local-repo.d.ts +17 -0
- package/dist/coding/local-repo.js +65 -0
- package/dist/coding/observability.d.ts +1 -1
- package/dist/coding/observability.js +1 -0
- package/dist/coding/profile.d.ts +6 -0
- package/dist/coding/profile.js +13 -4
- package/dist/coding/protocol.d.ts +32 -7
- package/dist/coding/protocol.js +66 -4
- package/dist/coding-worker/artifact.d.ts +1 -0
- package/dist/coding-worker/errors.js +2 -0
- package/dist/config/providers.d.ts +13 -0
- package/dist/config/providers.js +21 -9
- package/dist/core/attribution.d.ts +13 -0
- package/dist/core/attribution.js +30 -0
- package/dist/core/budget-groups.d.ts +3 -1
- package/dist/core/budget-groups.js +53 -5
- package/dist/core/ci-context.d.ts +8 -0
- package/dist/core/ci-context.js +59 -0
- package/dist/core/delegation-siblings.d.ts +22 -0
- package/dist/core/delegation-siblings.js +40 -0
- package/dist/core/dispatch.d.ts +28 -4
- package/dist/core/dispatch.js +57 -15
- package/dist/core/engine-native.d.ts +16 -0
- package/dist/core/engine-native.js +49 -2
- package/dist/core/host-events.d.ts +25 -2
- package/dist/core/host-events.js +361 -19
- package/dist/core/host-status.d.ts +8 -3
- package/dist/core/host-status.js +38 -7
- package/dist/core/issue-events.d.ts +2 -6
- package/dist/core/issue-events.js +13 -19
- package/dist/core/pull-request-state-sync.d.ts +17 -0
- package/dist/core/pull-request-state-sync.js +53 -0
- package/dist/core/reconciler.d.ts +10 -1
- package/dist/core/reconciler.js +15 -2
- package/dist/core/related-pull-requests.d.ts +95 -0
- package/dist/core/related-pull-requests.js +338 -0
- package/dist/core/repo-access.d.ts +5 -1
- package/dist/core/repo-access.js +17 -1
- package/dist/core/review-fix-ledger.d.ts +20 -0
- package/dist/core/review-fix-ledger.js +41 -0
- package/dist/core/review-fix.d.ts +60 -0
- package/dist/core/review-fix.js +155 -0
- package/dist/core/review-host-tools.d.ts +13 -2
- package/dist/core/review-host-tools.js +72 -11
- package/dist/core/runner.d.ts +2 -2
- package/dist/core/runner.js +379 -184
- package/dist/core/serial-gate.d.ts +11 -0
- package/dist/core/serial-gate.js +19 -0
- package/dist/core/timing.d.ts +7 -0
- package/dist/core/timing.js +7 -0
- package/dist/env.js +6 -1
- package/dist/generated/prisma/browser.d.ts +23 -0
- package/dist/generated/prisma/client.d.ts +23 -0
- package/dist/generated/prisma/commonInputTypes.d.ts +22 -0
- package/dist/generated/prisma/internal/class.d.ts +33 -0
- package/dist/generated/prisma/internal/class.js +4 -4
- package/dist/generated/prisma/internal/prismaNamespace.d.ts +274 -1
- package/dist/generated/prisma/internal/prismaNamespace.js +47 -2
- package/dist/generated/prisma/internal/prismaNamespaceBrowser.d.ts +48 -0
- package/dist/generated/prisma/internal/prismaNamespaceBrowser.js +47 -2
- package/dist/generated/prisma/models/Agent.d.ts +422 -1
- package/dist/generated/prisma/models/AgentRepository.d.ts +120 -2
- package/dist/generated/prisma/models/CodingAgentProfile.d.ts +42 -1
- package/dist/generated/prisma/models/CodingRun.d.ts +205 -1
- package/dist/generated/prisma/models/DeferredReview.d.ts +1336 -0
- package/dist/generated/prisma/models/DeferredReview.js +1 -0
- package/dist/generated/prisma/models/LocalPullRequest.d.ts +1384 -0
- package/dist/generated/prisma/models/LocalPullRequest.js +1 -0
- package/dist/generated/prisma/models/LocalReview.d.ts +1315 -0
- package/dist/generated/prisma/models/LocalReview.js +1 -0
- package/dist/generated/prisma/models/Run.d.ts +223 -0
- package/dist/generated/prisma/models/RunHostCheck.d.ts +148 -1
- package/dist/generated/prisma/models.d.ts +3 -0
- package/dist/help-index.json +476 -37
- package/dist/import/neutral-schema.d.ts +2 -2
- package/dist/mcp/auth/access.d.ts +3 -1
- package/dist/mcp/auth/host-account-cli.js +2 -2
- package/dist/mcp/auth/repo-authorization.d.ts +6 -7
- package/dist/mcp/auth/repo-authorization.js +21 -0
- package/dist/mcp/index.js +4 -1
- package/dist/mcp/tools/agents.js +46 -4
- package/dist/mcp/tools/host-accounts.js +2 -2
- package/dist/mcp/tools/repositories.js +71 -12
- package/dist/mcp/tools/runs.js +23 -0
- package/dist/mcp/tools/trigger.js +153 -24
- package/dist/providers/engine/types.d.ts +11 -0
- package/dist/providers/executor/composition.js +12 -7
- package/dist/providers/executor/container.d.ts +40 -3
- package/dist/providers/executor/container.js +140 -9
- package/dist/providers/executor/types.d.ts +1 -1
- package/dist/providers/jobs/fake-kubernetes-api.d.ts +3 -2
- package/dist/providers/jobs/fake-kubernetes-api.js +3 -0
- package/dist/providers/jobs/kubernetes-api.d.ts +3 -1
- package/dist/providers/jobs/kubernetes-client.d.ts +2 -1
- package/dist/providers/jobs/kubernetes-client.js +3 -0
- package/dist/providers/jobs/kubernetes-isolation.d.ts +7 -0
- package/dist/providers/jobs/kubernetes-isolation.js +8 -3
- package/dist/providers/jobs/kubernetes-preflight.d.ts +8 -0
- package/dist/providers/jobs/kubernetes-preflight.js +7 -0
- package/dist/providers/jobs/kubernetes-quota.d.ts +31 -0
- package/dist/providers/jobs/kubernetes-quota.js +110 -0
- package/dist/providers/jobs/kubernetes.d.ts +9 -0
- package/dist/providers/jobs/kubernetes.js +50 -0
- package/dist/providers/jobs/types.d.ts +7 -0
- package/dist/providers/review-host/ci.d.ts +7 -0
- package/dist/providers/review-host/ci.js +20 -0
- package/dist/providers/review-host/github-events.d.ts +7 -0
- package/dist/providers/review-host/github-events.js +31 -7
- package/dist/providers/review-host/github.d.ts +19 -2
- package/dist/providers/review-host/github.js +145 -2
- package/dist/providers/review-host/index.d.ts +8 -2
- package/dist/providers/review-host/index.js +14 -3
- package/dist/providers/review-host/local.d.ts +72 -0
- package/dist/providers/review-host/local.js +434 -0
- package/dist/providers/review-host/types.d.ts +65 -3
- package/dist/providers/review-host/types.js +5 -3
- package/dist/providers/vcs/git.d.ts +10 -20
- package/dist/providers/vcs/git.js +71 -127
- package/dist/providers/vcs/github-remote.d.ts +67 -0
- package/dist/providers/vcs/github-remote.js +201 -0
- package/dist/providers/vcs/github.d.ts +81 -0
- package/dist/providers/vcs/github.js +203 -6
- package/dist/providers/vcs/index.d.ts +16 -1
- package/dist/providers/vcs/index.js +43 -15
- package/dist/providers/vcs/local-remote.d.ts +44 -0
- package/dist/providers/vcs/local-remote.js +108 -0
- package/dist/providers/vcs/remote.d.ts +58 -0
- package/dist/providers/vcs/remote.js +1 -0
- package/dist/providers/vcs/routing.d.ts +33 -0
- package/dist/providers/vcs/routing.js +52 -0
- package/dist/providers/vcs/types.d.ts +12 -1
- package/dist/quickstart/coding-db.d.ts +11 -0
- package/dist/quickstart/coding-db.js +75 -0
- package/dist/quickstart/coding-doctor.d.ts +13 -0
- package/dist/quickstart/coding-doctor.js +88 -0
- package/dist/quickstart/coding-images.d.ts +15 -0
- package/dist/quickstart/coding-images.js +79 -0
- package/dist/quickstart/coding-seed.d.ts +63 -0
- package/dist/quickstart/coding-seed.js +85 -0
- package/dist/quickstart/coding.d.ts +66 -0
- package/dist/quickstart/coding.js +430 -0
- package/dist/quickstart/images.d.ts +19 -0
- package/dist/quickstart/images.js +63 -0
- package/dist/quickstart/index.d.ts +6 -0
- package/dist/quickstart/index.js +72 -40
- package/dist/quickstart/starter-services.d.ts +45 -0
- package/dist/quickstart/starter-services.js +186 -0
- package/dist/quickstart-images.json +1 -0
- package/dist/serve.js +14 -1
- package/dist/viewer/api-schema.d.ts +176 -0
- package/dist/viewer/api-schema.js +27 -2
- package/dist/viewer/graph.d.ts +7 -2
- package/dist/viewer/graph.js +25 -11
- package/dist/viewer/http.d.ts +7 -1
- package/dist/viewer/http.js +8 -3
- package/dist/viewer/infra.d.ts +2 -0
- package/dist/viewer/infra.js +23 -0
- package/dist/viewer/run-detail.d.ts +2 -1
- package/dist/viewer/run-detail.js +2 -2
- package/docs/agent-recipes.md +123 -2
- package/docs/code-review-agents.md +293 -38
- package/docs/coding-agent-setup.md +141 -2
- package/docs/coding-packages.md +21 -0
- package/docs/coding-services.md +3 -0
- package/docs/coding-worker-isolation.md +87 -24
- package/docs/getting-started-gke.md +24 -0
- package/docs/getting-started.md +82 -8
- package/docs/jira-agents.md +26 -5
- package/docs/security-deployment.md +9 -0
- package/docs/viewer-api.md +21 -2
- package/help/admin-viewer.md +11 -1
- package/help/agent-recipes.md +25 -1
- package/help/builder-agent.md +4 -0
- package/help/code-review-agents.md +82 -2
- package/help/coding-packages.md +12 -1
- package/help/coding-services.md +4 -0
- package/help/cost-attribution.md +3 -1
- package/help/creating-agents.md +3 -0
- package/help/deploy-gke.md +2 -1
- package/help/errors/coding-provider-not-configured.md +60 -0
- package/help/errors/coding-turn-limit.md +25 -0
- package/help/errors/continuation-closed.md +75 -0
- package/help/errors/local-branch-conflict.md +37 -0
- package/help/errors/local-path-invalid.md +30 -0
- package/help/errors/local-ref-invalid.md +36 -0
- package/help/errors/local-ref-not-found.md +41 -0
- package/help/errors/local-repo-not-allowed.md +46 -0
- package/help/errors/local-repo-not-found.md +39 -0
- package/help/errors/model-unavailable.md +7 -6
- package/help/errors/vcs-github-not-configured.md +34 -0
- package/help/getting-started.md +4 -0
- package/help/github.md +22 -5
- package/help/jira.md +9 -2
- package/help/local-repositories.md +182 -0
- package/help/related-pull-requests.md +89 -0
- package/help/review-fix-rounds.md +69 -0
- package/help/troubleshooting/budgets.md +11 -0
- package/help/troubleshooting/coding-workers.md +22 -0
- package/help/troubleshooting/repository-access.md +5 -0
- package/package.json +5 -3
- package/prisma/migrations/20261004100000_delegations_and_coding_turns/migration.sql +12 -0
- package/prisma/migrations/20261005000000_review_fix_rounds/migration.sql +5 -0
- package/prisma/migrations/20261006000000_parallel_delegations/migration.sql +6 -0
- package/prisma/migrations/20261007000000_ci_rereview/migration.sql +4 -0
- package/prisma/migrations/20261008000000_review_after_ci/migration.sql +33 -0
- package/prisma/migrations/20261009000001_coding_run_local_branch/migration.sql +7 -0
- package/prisma/migrations/20261009000002_local_review/migration.sql +50 -0
- package/prisma/schema.prisma +98 -1
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: local-repositories
|
|
3
|
+
title: Use local git repositories without a GitHub App
|
|
4
|
+
summary: Point coding and review agents at a git folder on the wardby host (local:/abs/path), with no GitHub App and no git worktree. Results land as branches in that repository. Needs LOCAL_REPO_ROOTS trusted folders and the Docker or Kubernetes job launcher.
|
|
5
|
+
audience: operator
|
|
6
|
+
tags: [local, local-repo, worktree, git, quickstart, review, coding, LOCAL_REPO_ROOTS]
|
|
7
|
+
appliesTo: ">=0.5.0"
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Use local git repositories without a GitHub App
|
|
11
|
+
|
|
12
|
+
A coding or review agent can work on a git folder on the machine that runs the
|
|
13
|
+
wardby server instead of a GitHub repository. You write the repository as
|
|
14
|
+
`local:/absolute/path`. No GitHub App, GitHub account link or webhook is needed.
|
|
15
|
+
|
|
16
|
+
- A **coding agent** clones the repository's committed history, works in the
|
|
17
|
+
sandbox as usual, and wardby pushes the result into your repository as a new
|
|
18
|
+
branch `wardby/run-<run id>`. Wardby clones; it does not create a git
|
|
19
|
+
worktree in your repository.
|
|
20
|
+
- A **review agent** reviews a branch of the repository against a base branch
|
|
21
|
+
when you ask for it with `trigger_agent`.
|
|
22
|
+
|
|
23
|
+
The easiest way to try it is the optional coding step of
|
|
24
|
+
`npx --yes @wardby/cli@latest quickstart` (see
|
|
25
|
+
[Quickstart coding step](#quickstart-coding-step)).
|
|
26
|
+
|
|
27
|
+
## Requirements
|
|
28
|
+
|
|
29
|
+
- **A single-user or personal server.** Set `LOCAL_REPO_ROOTS` only on a
|
|
30
|
+
server that you alone use. Every principal who can create or update agents
|
|
31
|
+
or link repositories can use every repository under the trusted folders:
|
|
32
|
+
its committed code is sent to the model, and runs push `wardby/run-*`
|
|
33
|
+
branches into it. Anyone with execute access to a local coding agent can
|
|
34
|
+
trigger such pushes.
|
|
35
|
+
- **Trusted folders.** Set `LOCAL_REPO_ROOTS` on the wardby server to the
|
|
36
|
+
folders wardby may use, separated by the platform's path delimiter (`:` on
|
|
37
|
+
macOS and Linux, `;` on Windows). While it is unset, every `local:` repository
|
|
38
|
+
is refused with `local_repo_not_allowed`. A repository must be a git work tree
|
|
39
|
+
whose real path (symlinks resolved) is at or below one of the folders.
|
|
40
|
+
Wardby stores the repository by that real path. It checks the folders again
|
|
41
|
+
when you create or update an agent, link a repository, trigger a run, and
|
|
42
|
+
while a run uses the repository. Restart the server after changing the
|
|
43
|
+
variable.
|
|
44
|
+
- **The Docker or Kubernetes job launcher.** Coding agents run in an isolated
|
|
45
|
+
worker, so set `JOB_LAUNCHER=docker` (or `kubernetes`). With
|
|
46
|
+
`JOB_LAUNCHER=local` a coding run ends with "Coding agents need a container
|
|
47
|
+
executor". Review agents are native agents and need no worker.
|
|
48
|
+
- **The server on the same machine as the folders.** Wardby reads and writes
|
|
49
|
+
your repository directly. A control plane in a container, a pod or on another
|
|
50
|
+
machine cannot see the folder: it ignores a trusted folder that does not
|
|
51
|
+
exist, so the repository fails with `local_repo_not_allowed`, and `doctor`
|
|
52
|
+
reports the folder as missing.
|
|
53
|
+
- **git 2.24 or newer** on the machine that runs the wardby server.
|
|
54
|
+
- **Worker images from this release or later.** An older worker image rejects
|
|
55
|
+
a `local:` repository and the run fails with `worker_input_failed`. That
|
|
56
|
+
includes a bring-your-own `workerImageRef` image: rebuild it on a current
|
|
57
|
+
driver image.
|
|
58
|
+
|
|
59
|
+
## Coding agents
|
|
60
|
+
|
|
61
|
+
Create a coding agent with `create_agent` and
|
|
62
|
+
`codingProfile.repository: "local:/abs/path"`, or change an existing agent with
|
|
63
|
+
`update_agent`. Start it with `trigger_agent {agentId, task, baseRef?}`.
|
|
64
|
+
`baseRef` defaults to the profile's base ref.
|
|
65
|
+
|
|
66
|
+
What happens:
|
|
67
|
+
|
|
68
|
+
1. Wardby clones the repository's **committed** history. Untracked and
|
|
69
|
+
uncommitted files, such as a `.env.local`, never leave your machine.
|
|
70
|
+
2. The worker makes its changes in the sandbox, as it does for GitHub.
|
|
71
|
+
3. Wardby validates the result and pushes a single commit to the branch
|
|
72
|
+
`wardby/run-<run id>` in your repository. Your working tree, index and
|
|
73
|
+
checked-out branch are never modified.
|
|
74
|
+
4. `get_run` shows `resultBranch` and `baseSha` (the commit the run started
|
|
75
|
+
from). Merge the branch the way you merge any branch.
|
|
76
|
+
|
|
77
|
+
Things to know:
|
|
78
|
+
|
|
79
|
+
- Your repository's own receive-side hooks (for example `pre-receive` and
|
|
80
|
+
`update`) run when wardby pushes. A hook that rejects the push fails the run.
|
|
81
|
+
- `trigger_agent` returns `warnings` when the repository has uncommitted files,
|
|
82
|
+
submodules or Git LFS files. The run still starts, but uncommitted files are
|
|
83
|
+
not included and submodules and LFS are **not supported**: submodules are not
|
|
84
|
+
initialized and LFS files are not fetched.
|
|
85
|
+
- A run can start from an earlier result: pass `baseRef: "wardby/run-<run id>"`
|
|
86
|
+
to build on that branch. A continuation of a run (a lead agent revising its
|
|
87
|
+
earlier work) fast-forwards the same branch. If that branch has moved, or is
|
|
88
|
+
checked out in your repository, the run fails with `local_branch_conflict`.
|
|
89
|
+
- Wardby never deletes result branches. Remove one you no longer need with
|
|
90
|
+
`git branch -D wardby/run-<run id>`.
|
|
91
|
+
- `.wardby/services.yaml` works for local runs. It is read from the committed
|
|
92
|
+
file at the run's base ref, never from your working tree, and fails with the
|
|
93
|
+
same errors as on GitHub (for example `service_declaration_invalid`). See
|
|
94
|
+
[Give coding runs the services their tests need](coding-services.md).
|
|
95
|
+
|
|
96
|
+
## Review agents
|
|
97
|
+
|
|
98
|
+
1. Create a native review agent (a normal agent with a review prompt that uses
|
|
99
|
+
the `repo_*` tools) and link it with `link_repository` using
|
|
100
|
+
`provider: "local"`, `repository: "local:/abs/path"` and `access: "write"`
|
|
101
|
+
(publishing a review needs write). A local link is manual only: give it no
|
|
102
|
+
`triggers` and no `checkName`.
|
|
103
|
+
2. Start a review with
|
|
104
|
+
`trigger_agent {agentId, review: {repository?, branch, base?}}`. Only the
|
|
105
|
+
agent's owner can. `repository` defaults to the agent's only local link, and
|
|
106
|
+
`base` defaults to the branch checked out in the repository.
|
|
107
|
+
3. The `repo_pr_read`, `repo_read_file`, `repo_list_files`, `repo_publish_review`
|
|
108
|
+
and `repo_comment` tools work unchanged, reading committed content at the
|
|
109
|
+
branch and never your working tree.
|
|
110
|
+
4. `get_run` returns the result in `review`: `number`, `branch`, `base` and
|
|
111
|
+
`reviews`, each with `verdict`, `summary`, `body` and `comments`.
|
|
112
|
+
|
|
113
|
+
There are no check runs and no CI results for a local review, and event
|
|
114
|
+
triggers (`pull_request`, `push`, `mention`, `review_fix`) are rejected for
|
|
115
|
+
local repositories.
|
|
116
|
+
|
|
117
|
+
A typical loop: trigger the coding agent, read `resultBranch` from `get_run`,
|
|
118
|
+
then trigger the review agent with `review: {branch: "<resultBranch>"}`.
|
|
119
|
+
|
|
120
|
+
## Quickstart coding step
|
|
121
|
+
|
|
122
|
+
`quickstart` asks "Set up coding + review agents against a local git repo?"
|
|
123
|
+
after the sample agent. It needs Docker and, for the coding provider you
|
|
124
|
+
choose, an `OPENAI_API_KEY` (Codex) or `ANTHROPIC_API_KEY` (Claude Code). It
|
|
125
|
+
then:
|
|
126
|
+
|
|
127
|
+
- asks which folders to trust (offering the git root of the current directory)
|
|
128
|
+
and writes `LOCAL_REPO_ROOTS` and `JOB_LAUNCHER=docker` to `.wardby/.env`;
|
|
129
|
+
- gets only the chosen provider's images, pulled by digest from a release or
|
|
130
|
+
built from a wardby source checkout: the runtime image plus the Codex worker
|
|
131
|
+
for Codex, or the runtime image plus the Claude worker and tool-runner images
|
|
132
|
+
for Claude Code. A Claude-only setup does not need or set
|
|
133
|
+
`CODING_WORKER_IMAGE`; images another provider set up on an earlier run are
|
|
134
|
+
kept. `WARDBY_RUNTIME_IMAGE` together with `CODING_WORKER_IMAGE`, or
|
|
135
|
+
`CODING_CLAUDE_WORKER_IMAGE` plus `CODING_CLAUDE_TOOL_RUNNER_IMAGE`, override
|
|
136
|
+
them with your own digests;
|
|
137
|
+
- starts the coding proxy and runs the coding preflight;
|
|
138
|
+
- finds the repository: a trusted folder that is a git repository, or the
|
|
139
|
+
repositories directly inside a trusted folder (hidden folders are skipped).
|
|
140
|
+
With several it asks which to use; non-interactively it uses the first in
|
|
141
|
+
sorted order and prints the choice. Re-run with `--trust <repo>` to pick
|
|
142
|
+
another: folders passed on a run take precedence over saved ones;
|
|
143
|
+
- creates `local-builder` (a coding agent, $2 budget) and `local-reviewer`
|
|
144
|
+
(a review agent, $1 budget) for the repository and prints the two
|
|
145
|
+
`trigger_agent` calls to try; and
|
|
146
|
+
- if the repository has no `.wardby/services.yaml`, offers a starter one with
|
|
147
|
+
PostgreSQL and/or Redis. It is committed to the branch
|
|
148
|
+
`wardby/quickstart-services` without touching your working tree. Merge that
|
|
149
|
+
branch, or set the agent's `baseRef` to it. When a services file exists
|
|
150
|
+
already, quickstart shows what it declares or why it is invalid. The "default
|
|
151
|
+
branch" is whichever branch is checked out when quickstart runs.
|
|
152
|
+
|
|
153
|
+
Flags: `--coding` (run the step), `--no-coding` (skip it), `--trust <dir>`
|
|
154
|
+
(repeatable), `--coding-provider codex|claude-code` and
|
|
155
|
+
`--starter-services postgres,redis|none`. In `--non-interactive` mode the step
|
|
156
|
+
only runs with `--coding`, and it needs at least one `--trust`. `doctor` and
|
|
157
|
+
`status` report the trusted folders, worker image, coding proxy and each local
|
|
158
|
+
agent's repository, and `down` stops the proxy with the database.
|
|
159
|
+
|
|
160
|
+
## Errors
|
|
161
|
+
|
|
162
|
+
- [`local_repo_not_allowed`](errors/local-repo-not-allowed.md): outside every
|
|
163
|
+
trusted folder, `LOCAL_REPO_ROOTS` is unset, or the server cannot see the
|
|
164
|
+
trusted folder.
|
|
165
|
+
- [`local_repo_not_found`](errors/local-repo-not-found.md): missing, not a git
|
|
166
|
+
work tree, or not readable by the server.
|
|
167
|
+
- [`local_ref_not_found`](errors/local-ref-not-found.md): the branch or base
|
|
168
|
+
does not exist.
|
|
169
|
+
- [`local_ref_invalid`](errors/local-ref-invalid.md): not a valid branch name.
|
|
170
|
+
- [`local_path_invalid`](errors/local-path-invalid.md): an unsafe file path in
|
|
171
|
+
a repository read.
|
|
172
|
+
- [`local_branch_conflict`](errors/local-branch-conflict.md): the result branch
|
|
173
|
+
moved or is checked out.
|
|
174
|
+
- [`vcs_github_not_configured`](errors/vcs-github-not-configured.md): a coding
|
|
175
|
+
agent uses a GitHub repository on a server with only local repositories
|
|
176
|
+
configured.
|
|
177
|
+
|
|
178
|
+
Related: [Get started](getting-started.md),
|
|
179
|
+
[Connect GitHub repositories](github.md) (the alternative to a local
|
|
180
|
+
repository), [Run GitHub code-review agents](code-review-agents.md) and
|
|
181
|
+
[Give coding runs the services their tests need](coding-services.md). Operator
|
|
182
|
+
guide: [`docs/coding-agent-setup.md`](../docs/coding-agent-setup.md).
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: related-pull-requests
|
|
3
|
+
title: Related pull requests across repositories
|
|
4
|
+
summary: Wardby lists the other pull requests from the same request in each pull request's description, with a suggested merge order.
|
|
5
|
+
audience: operator
|
|
6
|
+
tags: [github, pull-requests, multi-repo, merge-order, related, siblings, continuePriorRun, coding-agents, jira]
|
|
7
|
+
appliesTo: ">=0.4.2"
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Related pull requests across repositories
|
|
11
|
+
|
|
12
|
+
When one request produces pull requests in several repositories — a lead
|
|
13
|
+
agent that delegates to one coding agent per repository, or several runs for
|
|
14
|
+
the same Jira issue — Wardby adds a **Related pull requests** section to each
|
|
15
|
+
of those pull requests' descriptions. It lists the others with links and
|
|
16
|
+
their state, names the originating issue when there is one, and gives a
|
|
17
|
+
suggested merge order.
|
|
18
|
+
|
|
19
|
+
Without a tracked Jira issue, the list covers the pull requests opened by
|
|
20
|
+
runs in the same delegation tree (the same lead run and everything it
|
|
21
|
+
started). With a tracked issue, the list covers every pull request Wardby
|
|
22
|
+
has recorded for that issue across every run, merged and closed ones
|
|
23
|
+
included, plus that run tree's own siblings.
|
|
24
|
+
|
|
25
|
+
- **Written by Wardby, not the model.** The list comes from Wardby's own run
|
|
26
|
+
records, never from the agent's text. Edits you make inside the section
|
|
27
|
+
are replaced on the next rewrite; text outside it is left alone.
|
|
28
|
+
- **When.** A pull request already lists the ones opened earlier in the same
|
|
29
|
+
request when it is opened. When the lead run finishes, Wardby rewrites the
|
|
30
|
+
section on every open pull request of the request with the full list and
|
|
31
|
+
current states. A later run that pushes to any pull request in the set
|
|
32
|
+
refreshes the section on all of them the same way, and never removes it.
|
|
33
|
+
- **Suggested merge order (the order Wardby's agent opened them in)** numbers
|
|
34
|
+
the open (and draft) pull requests in delegation order. It is not a
|
|
35
|
+
dependency analysis — it is only reliable when the lead delegates
|
|
36
|
+
repositories that own shared data first (see
|
|
37
|
+
[Fanning out to several builders](../docs/agent-recipes.md#fanning-out-to-several-builders)).
|
|
38
|
+
Check it before merging. Merged and closed pull requests follow in a
|
|
39
|
+
separate "Already merged or closed" list, as context only.
|
|
40
|
+
- Only open pull requests that Wardby's own GitHub App opened are edited;
|
|
41
|
+
merged or closed ones are listed but never changed, and a pull request
|
|
42
|
+
from a different Wardby deployment sharing the same App is never touched.
|
|
43
|
+
- **Repository names are visible across the set.** The section (and the
|
|
44
|
+
follow-up hints below) lists every pull request in the set by repository
|
|
45
|
+
name and number, so a request that spans repositories of different
|
|
46
|
+
visibility can show a private repository's name in a public repository's
|
|
47
|
+
pull request. If you mix public and private repositories, keep such work in
|
|
48
|
+
separate requests: separate Jira issues, or separate lead agents.
|
|
49
|
+
|
|
50
|
+
Reviewers see the section in the pull request description, so a reviewer
|
|
51
|
+
agent can tell that a field, route, or schema a change relies on is added by
|
|
52
|
+
a sibling pull request rather than missing. See the reviewer step in
|
|
53
|
+
[Run GitHub code-review agents](code-review-agents.md#ci-and-sibling-pull-requests).
|
|
54
|
+
|
|
55
|
+
## Follow-up runs and sibling pull requests
|
|
56
|
+
|
|
57
|
+
When someone asks for a follow-up on one of these pull requests (an
|
|
58
|
+
`@<app-slug>` mention, or a new Jira event on the issue), the task given to
|
|
59
|
+
the agent also lists every **open** sibling pull request in the set, with
|
|
60
|
+
its link and the exact `continuePriorRun` value that continues it, together
|
|
61
|
+
with guidance not to open a duplicate pull request in a repository that
|
|
62
|
+
already has one open for this request. Automatic review fix rounds get no
|
|
63
|
+
such hints: a fix round's task names only its own pull request. Merged and
|
|
64
|
+
closed pull requests are never listed as continuable: a change there needs a
|
|
65
|
+
new pull request, which joins the set once it is recorded.
|
|
66
|
+
|
|
67
|
+
Give your own delivery or router agent's system prompt a line such as:
|
|
68
|
+
|
|
69
|
+
Continue the pull request you were asked about, and any listed open
|
|
70
|
+
sibling the change requires; never open a new pull request in a
|
|
71
|
+
repository that already has an open sibling for this request.
|
|
72
|
+
|
|
73
|
+
The usual limits still apply: `maxDelegationsPerRun` and never delegating to
|
|
74
|
+
the same sub-agent twice in one run; every push to a sibling pull request
|
|
75
|
+
gets its own review; fix rounds are capped per pull request and only one
|
|
76
|
+
runs at a time on a pull request; and a continuation only ever reaches a
|
|
77
|
+
sub-agent that shares the same owner as the one asked to continue it.
|
|
78
|
+
|
|
79
|
+
A continuation never pushes to a pull request that has been merged or closed
|
|
80
|
+
in the meantime: the coding run stops before it starts work (or right before
|
|
81
|
+
it pushes) with failure category `continuation_closed`, and the delegating
|
|
82
|
+
agent is told to make the change as a new pull request instead. See
|
|
83
|
+
[Continuation's pull request is no longer open](errors/continuation-closed.md).
|
|
84
|
+
|
|
85
|
+
Wardby also keeps the recorded state of issue-linked pull requests current
|
|
86
|
+
even when GitHub's merge or close webhook delivery was missed: it re-checks
|
|
87
|
+
open ones in the background, at most ten at a time, each at most every ten
|
|
88
|
+
minutes, and applies the same comment and status move a normal webhook would
|
|
89
|
+
have triggered.
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: review-fix-rounds
|
|
3
|
+
title: Automatic review fix rounds
|
|
4
|
+
summary: Let wardby fix its own review's findings on pull requests its coding runs opened, with a round cap.
|
|
5
|
+
audience: operator
|
|
6
|
+
tags: [github, code-review, review_fix, autofix, fix-round, pull-requests]
|
|
7
|
+
appliesTo: ">=0.4.2"
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Automatic review fix rounds
|
|
11
|
+
|
|
12
|
+
Link an agent with the `review_fix` trigger and wardby will try to fix its
|
|
13
|
+
own code review's findings automatically, instead of waiting for a human to
|
|
14
|
+
ask. Use `link_repository` with `access: "write"`, `triggers` including
|
|
15
|
+
`review_fix`, and an optional `reviewFixMaxRounds` (1–10, default 2); only
|
|
16
|
+
one agent per repository may hold this trigger.
|
|
17
|
+
|
|
18
|
+
A round starts when wardby's own review check on a pull request comes back
|
|
19
|
+
`CHANGES_REQUESTED` and the pull request is still open, not from a fork,
|
|
20
|
+
still at the commit that was reviewed, and was opened by a wardby coding run
|
|
21
|
+
of this same deployment. No human comment is involved — it runs on the
|
|
22
|
+
`review_fix` link's own authorization. The agent is asked to fix only the
|
|
23
|
+
CRITICAL/MAJOR findings and MUST_FIX recommendations and change nothing
|
|
24
|
+
else; what it actually changes, and how much budget it uses, is still up to
|
|
25
|
+
the agent's own instructions.
|
|
26
|
+
|
|
27
|
+
The review is passed to the agent as untrusted context — information about
|
|
28
|
+
what to fix, never instructions to follow. Only the review's summary and
|
|
29
|
+
body reach the agent, not its inline comments, so write your reviewer's
|
|
30
|
+
prompt to list every finding in the review body. A review that is wrong
|
|
31
|
+
about CI or about a sibling pull request starts a round that changes
|
|
32
|
+
nothing; give your reviewer the CI and related-pull-requests step from
|
|
33
|
+
[Run GitHub code-review agents](code-review-agents.md#ci-and-sibling-pull-requests).
|
|
34
|
+
|
|
35
|
+
A round isn't started while an earlier round on the same pull request is
|
|
36
|
+
still running. Clicking **Re-run** on the review check isn't counted as a
|
|
37
|
+
round itself; if the re-run's review requests changes, that starts a round
|
|
38
|
+
like any other review.
|
|
39
|
+
|
|
40
|
+
Rounds are tracked with labels on the pull request:
|
|
41
|
+
|
|
42
|
+
- `wardby-autofix-<N>` — one per round, added before that round's run
|
|
43
|
+
starts.
|
|
44
|
+
- `wardby-autofix-limit` — added once the cap is reached; wardby posts one
|
|
45
|
+
comment and stops.
|
|
46
|
+
- `wardby-autofix-off` — add this by hand to opt a pull request out
|
|
47
|
+
entirely.
|
|
48
|
+
|
|
49
|
+
To let a capped pull request have more rounds, remove the round labels
|
|
50
|
+
together with `wardby-autofix-limit` (a leftover
|
|
51
|
+
`wardby-autofix-limit` means there's no comment when the cap is reached
|
|
52
|
+
again). A pull request opened by a different wardby
|
|
53
|
+
deployment gets one refusal comment and `wardby-autofix-limit` instead of a
|
|
54
|
+
round, since this deployment can't continue a branch it has no record of
|
|
55
|
+
opening.
|
|
56
|
+
|
|
57
|
+
A round's run also double-checks with GitHub that the pull request is still
|
|
58
|
+
open right before it pushes; one merged or closed in the time the round was
|
|
59
|
+
working fails with no push made — see
|
|
60
|
+
[Continuation's pull request is no longer open](errors/continuation-closed.md).
|
|
61
|
+
|
|
62
|
+
If a repository already forwards reviews to a webhook through a
|
|
63
|
+
hand-written CI workflow to fix them automatically, turn on `review_fix` and
|
|
64
|
+
then remove that workflow and its webhook, so a review doesn't trigger two
|
|
65
|
+
fix rounds at once.
|
|
66
|
+
|
|
67
|
+
See [`docs/code-review-agents.md`](../docs/code-review-agents.md#automatic-review-fix-rounds)
|
|
68
|
+
for the full trigger rules, the App's required permissions, and the related
|
|
69
|
+
[code-review-agents](code-review-agents.md) article.
|
|
@@ -29,4 +29,15 @@ what the parent (and any earlier sub-agents) have already spent, so a parent
|
|
|
29
29
|
that spends heavily before delegating can leave a sub-agent refused with
|
|
30
30
|
`run_tree_exhausted`.
|
|
31
31
|
|
|
32
|
+
Sub-agents started together (a lead with `parallelDelegations`) also count each
|
|
33
|
+
other's unspent reservations, so the last one admitted can be refused with
|
|
34
|
+
`run_tree_exhausted` even though no sub-agent has spent much yet. If a
|
|
35
|
+
sibling is still running when that happens, the refused sub-agent waits for
|
|
36
|
+
it to finish and retries instead of failing immediately — up to roughly
|
|
37
|
+
twice its normal wait bound in total; with no sibling running, the refusal is
|
|
38
|
+
immediate. A sub-agent that is waiting for budget still counts toward the
|
|
39
|
+
lead's `maxDelegationsPerRun`, so a delegation beyond the limit is refused
|
|
40
|
+
with `already_dispatched` and a message naming how many delegations were
|
|
41
|
+
made and how many are waiting for budget.
|
|
42
|
+
|
|
32
43
|
For a shared-group refusal, read [Budget group exhausted](../errors/budget-group-exhausted.md).
|
|
@@ -23,6 +23,28 @@ Review the deployment guide for your target before assigning a coding profile.
|
|
|
23
23
|
|
|
24
24
|
For the specific isolation refusal, read [Coding-worker isolation unavailable](../errors/docker-isolation-unsupported.md).
|
|
25
25
|
|
|
26
|
+
## Runs that stop at the turn limit
|
|
27
|
+
|
|
28
|
+
A Claude Code run whose failure category is `turn_limit` reached its agent's
|
|
29
|
+
turn limit (worker error `coding_turn_limit`): 200 model calls by default. The
|
|
30
|
+
work was too large for the limit, or the agent was looping. Read the run's
|
|
31
|
+
summary and debug trace (`codingProfile.debugTraceMinutes`) to tell which;
|
|
32
|
+
raise `codingProfile.maxTurns` (up to 1000) with `update_agent` for the first,
|
|
33
|
+
or narrow the task for the second. Codex runs have no turn limit. See
|
|
34
|
+
[Coding run reached its turn limit](../errors/coding-turn-limit.md).
|
|
35
|
+
|
|
36
|
+
## Runs that wait for cluster capacity
|
|
37
|
+
|
|
38
|
+
On Kubernetes with `KUBERNETES_RESOURCE_QUOTA` set, a run whose pod would not
|
|
39
|
+
fit the namespace quota stays `pending` with `codingQueuedAt` set, like a run
|
|
40
|
+
over `CODING_MAX_CONCURRENT`, and starts once other runs finish. A run still
|
|
41
|
+
waiting after `CODING_QUEUE_TIMEOUT_SEC` fails with `coding_queue_timeout`:
|
|
42
|
+
raise the quota, lower the run pods' size, or lower `CODING_MAX_CONCURRENT` so
|
|
43
|
+
fewer runs compete.
|
|
44
|
+
|
|
45
|
+
A lead agent with `parallelDelegations` starts several coding runs together;
|
|
46
|
+
expect some of them to queue when the lead fans out wider than the free slots.
|
|
47
|
+
|
|
26
48
|
## Service refusals and failures
|
|
27
49
|
|
|
28
50
|
A repository can declare services such as PostgreSQL in `.wardby/services.yaml`
|
|
@@ -25,3 +25,8 @@ and re-run the work later.
|
|
|
25
25
|
|
|
26
26
|
Read [Repository access refused](../errors/repo-access.md) for the safe
|
|
27
27
|
remediation sequence.
|
|
28
|
+
|
|
29
|
+
The same authorization check gates an [automatic review fix
|
|
30
|
+
round](../review-fix-rounds.md): a `review_fix` link that fails it simply
|
|
31
|
+
skips starting that round, with no comment on the pull request, until
|
|
32
|
+
access is restored.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wardby/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Self-hosted control plane for budget-guarded AI agents.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://github.com/wardby/wardby#readme",
|
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
"NOTICE",
|
|
37
37
|
"bin/",
|
|
38
38
|
"docs/",
|
|
39
|
+
"deploy/local/docker-compose.quickstart-coding.yml",
|
|
39
40
|
"deploy/local/docker-compose.yml",
|
|
40
41
|
"dist/",
|
|
41
42
|
"help/",
|
|
@@ -60,6 +61,7 @@
|
|
|
60
61
|
"prepare": "npm run build:vendor && PRISMA_HIDE_UPDATE_MESSAGE=1 prisma generate",
|
|
61
62
|
"prepack": "npm run build",
|
|
62
63
|
"cli": "tsx --conditions=wardby-source src/cli.ts",
|
|
64
|
+
"codex:rerecord": "tsx --conditions=wardby-source src/tools/codex-rerecord.ts",
|
|
63
65
|
"capture:autopilot": "tsx --conditions=wardby-source src/tools/capture-autopilot-dry-run.ts",
|
|
64
66
|
"test": "npm run build:vendor && vitest run",
|
|
65
67
|
"test:package": "node scripts/npm-package-acceptance.mjs",
|
|
@@ -94,7 +96,7 @@
|
|
|
94
96
|
"@anthropic-ai/sdk": "^0.124.0",
|
|
95
97
|
"@dbos-inc/dbos-sdk": "4.27.6",
|
|
96
98
|
"@kubernetes/client-node": "^2.0.0",
|
|
97
|
-
"@modelcontextprotocol/client": "^2.
|
|
99
|
+
"@modelcontextprotocol/client": "^2.3.1",
|
|
98
100
|
"@modelcontextprotocol/node": "^2.0.0",
|
|
99
101
|
"@modelcontextprotocol/server": "^2.0.0",
|
|
100
102
|
"@prisma/adapter-pg": "7.10.0",
|
|
@@ -122,7 +124,7 @@
|
|
|
122
124
|
},
|
|
123
125
|
"devDependencies": {
|
|
124
126
|
"@eslint/js": "^10.0.1",
|
|
125
|
-
"@openai/codex-sdk": "0.
|
|
127
|
+
"@openai/codex-sdk": "0.159.2",
|
|
126
128
|
"@types/node": "^24.0.0",
|
|
127
129
|
"@types/papaparse": "^5.5.2",
|
|
128
130
|
"@types/pg": "8.23.1",
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
-- Sub-agent fan-out and Claude Code turn limits (docs/agent-recipes.md, docs/coding-agent-setup.md).
|
|
2
|
+
-- Additive: two new columns. Every existing agent keeps one delegation per run;
|
|
3
|
+
-- every existing coding profile and run keeps the worker's default turn limit.
|
|
4
|
+
|
|
5
|
+
-- AlterTable
|
|
6
|
+
ALTER TABLE "Agent" ADD COLUMN "maxDelegationsPerRun" INTEGER NOT NULL DEFAULT 1;
|
|
7
|
+
|
|
8
|
+
-- AlterTable
|
|
9
|
+
ALTER TABLE "CodingAgentProfile" ADD COLUMN "maxTurns" INTEGER;
|
|
10
|
+
|
|
11
|
+
-- AlterTable
|
|
12
|
+
ALTER TABLE "CodingRun" ADD COLUMN "maxTurns" INTEGER;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
-- Automatic review fix rounds: a per-link round cap, and the verdict and
|
|
2
|
+
-- review text a reviewer run published on its own check.
|
|
3
|
+
ALTER TABLE "AgentRepository" ADD COLUMN "reviewFixMaxRounds" INTEGER;
|
|
4
|
+
ALTER TABLE "RunHostCheck" ADD COLUMN "verdict" TEXT;
|
|
5
|
+
ALTER TABLE "RunHostCheck" ADD COLUMN "reviewBody" TEXT;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
-- Parallel delegations (docs/agent-recipes.md): a native lead's delegate_to_*
|
|
2
|
+
-- calls made in one model turn run at the same time. Additive: every existing
|
|
3
|
+
-- agent keeps running its delegations one after another.
|
|
4
|
+
|
|
5
|
+
-- AlterTable
|
|
6
|
+
ALTER TABLE "Agent" ADD COLUMN "parallelDelegations" BOOLEAN NOT NULL DEFAULT false;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
-- Additive: a repository link can hold its review until that head's own CI
|
|
2
|
+
-- finishes (AgentRepository.waitForCi), and DeferredReview records a review
|
|
3
|
+
-- held that way until the ci_completed event or the reconciler's fallback
|
|
4
|
+
-- sweep starts it.
|
|
5
|
+
|
|
6
|
+
-- AlterTable
|
|
7
|
+
ALTER TABLE "AgentRepository" ADD COLUMN "waitForCi" BOOLEAN NOT NULL DEFAULT false;
|
|
8
|
+
|
|
9
|
+
-- CreateTable
|
|
10
|
+
CREATE TABLE "DeferredReview" (
|
|
11
|
+
"id" TEXT NOT NULL,
|
|
12
|
+
"provider" TEXT NOT NULL,
|
|
13
|
+
"repository" TEXT NOT NULL,
|
|
14
|
+
"prNumber" INTEGER NOT NULL,
|
|
15
|
+
"headSha" TEXT NOT NULL,
|
|
16
|
+
"agentId" TEXT NOT NULL,
|
|
17
|
+
"checkName" TEXT NOT NULL,
|
|
18
|
+
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
19
|
+
|
|
20
|
+
CONSTRAINT "DeferredReview_pkey" PRIMARY KEY ("id")
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
-- CreateIndex
|
|
24
|
+
CREATE UNIQUE INDEX "DeferredReview_provider_repository_prNumber_headSha_agentId_key" ON "DeferredReview"("provider", "repository", "prNumber", "headSha", "agentId");
|
|
25
|
+
|
|
26
|
+
-- CreateIndex
|
|
27
|
+
CREATE INDEX "DeferredReview_provider_repository_headSha_idx" ON "DeferredReview"("provider", "repository", "headSha");
|
|
28
|
+
|
|
29
|
+
-- CreateIndex
|
|
30
|
+
CREATE INDEX "DeferredReview_createdAt_idx" ON "DeferredReview"("createdAt");
|
|
31
|
+
|
|
32
|
+
-- AddForeignKey
|
|
33
|
+
ALTER TABLE "DeferredReview" ADD CONSTRAINT "DeferredReview_agentId_fkey" FOREIGN KEY ("agentId") REFERENCES "Agent"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
-- Additive: a coding run on a local repository pushes a branch instead of
|
|
2
|
+
-- opening a pull request, so CodingRun records that branch (resultBranch) and
|
|
3
|
+
-- the commit the run started from (baseSha, recorded for every outcome).
|
|
4
|
+
|
|
5
|
+
-- AlterTable
|
|
6
|
+
ALTER TABLE "CodingRun" ADD COLUMN "resultBranch" TEXT,
|
|
7
|
+
ADD COLUMN "baseSha" TEXT;
|
|
@@ -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;
|