@nanobpm/urban-pr-review-codefirst 0.1.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/release.yml +58 -0
- package/.releaserc.json +17 -0
- package/CHANGELOG.md +18 -0
- package/LICENSE +202 -0
- package/README.md +153 -5
- package/components/review-round.json +2 -2
- package/deno.json +1 -1
- package/deno.lock +1623 -29
- package/main.ts +4 -3
- package/nano-ide.ext.json +7 -0
- package/package.json +20 -3
- package/workflows/convergence-loop.ts +7 -4
- package/nano-generated/app-pages.ts +0 -676
- package/nano-generated/data-cli.ts +0 -552
- package/nano-generated/data-sdk.ts +0 -536
- package/nano-generated/domain-rows.d.ts +0 -87
- package/nano-generated/domain-types.ts +0 -1418
- package/nano-generated/domain.ts +0 -36
- package/nano-generated/llm-worker.ts +0 -403
- package/nano-generated/message-io.d.ts +0 -17
- package/nano-generated/messages.ts +0 -26
- package/nano-generated/meta.ts +0 -18
- package/nano-generated/node-deno-shim.mjs +0 -250
- package/nano-generated/node-loader.mjs +0 -60
- package/nano-generated/node-register.mjs +0 -11
- package/nano-generated/worker-io.d.ts +0 -28
- package/nano-generated/worker-sdk.ts +0 -468
- package/nano-generated/workers.ts +0 -29
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
|
|
7
|
+
# Prevent overlapping releases from racing on the same branch.
|
|
8
|
+
concurrency:
|
|
9
|
+
group: release-${{ github.ref }}
|
|
10
|
+
cancel-in-progress: false
|
|
11
|
+
|
|
12
|
+
permissions:
|
|
13
|
+
contents: read
|
|
14
|
+
|
|
15
|
+
jobs:
|
|
16
|
+
release:
|
|
17
|
+
name: semantic-release
|
|
18
|
+
runs-on: ubuntu-latest
|
|
19
|
+
# `[skip ci]` on the release commit already prevents a re-trigger, but guard
|
|
20
|
+
# against loops from any automated release commit as well.
|
|
21
|
+
if: "!contains(github.event.head_commit.message, '[skip ci]')"
|
|
22
|
+
permissions:
|
|
23
|
+
contents: write # create tags, GitHub Releases, push CHANGELOG/version bump
|
|
24
|
+
issues: write # comment on released issues
|
|
25
|
+
pull-requests: write # comment on released PRs
|
|
26
|
+
id-token: write # OIDC token for npm Trusted Publishing (no NPM_TOKEN)
|
|
27
|
+
steps:
|
|
28
|
+
- name: Checkout
|
|
29
|
+
uses: actions/checkout@v4
|
|
30
|
+
with:
|
|
31
|
+
fetch-depth: 0 # semantic-release needs full history + tags
|
|
32
|
+
persist-credentials: true # let @semantic-release/git push the release commit
|
|
33
|
+
|
|
34
|
+
- name: Configure git author
|
|
35
|
+
run: |
|
|
36
|
+
git config user.name "github-actions[bot]"
|
|
37
|
+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
|
38
|
+
|
|
39
|
+
- name: Setup Node.js
|
|
40
|
+
uses: actions/setup-node@v4
|
|
41
|
+
with:
|
|
42
|
+
node-version: "24"
|
|
43
|
+
registry-url: "https://registry.npmjs.org"
|
|
44
|
+
|
|
45
|
+
- name: Ensure npm supports OIDC Trusted Publishing
|
|
46
|
+
# Pinned (not @latest) for reproducible, supply-chain-safe releases.
|
|
47
|
+
# Any version >= 11.5.1 supports npm Trusted Publishing (OIDC).
|
|
48
|
+
run: npm install -g npm@11.12.1
|
|
49
|
+
|
|
50
|
+
- name: Install dependencies
|
|
51
|
+
run: npm ci
|
|
52
|
+
|
|
53
|
+
- name: Release
|
|
54
|
+
env:
|
|
55
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
56
|
+
# No NPM_TOKEN / NODE_AUTH_TOKEN: publishing uses OIDC Trusted Publishing.
|
|
57
|
+
NPM_CONFIG_PROVENANCE: "true"
|
|
58
|
+
run: npx semantic-release
|
package/.releaserc.json
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"branches": ["main"],
|
|
3
|
+
"plugins": [
|
|
4
|
+
"@semantic-release/commit-analyzer",
|
|
5
|
+
"@semantic-release/release-notes-generator",
|
|
6
|
+
"@semantic-release/changelog",
|
|
7
|
+
"@semantic-release/npm",
|
|
8
|
+
"@semantic-release/github",
|
|
9
|
+
[
|
|
10
|
+
"@semantic-release/git",
|
|
11
|
+
{
|
|
12
|
+
"assets": ["CHANGELOG.md", "package.json", "package-lock.json"],
|
|
13
|
+
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
|
|
14
|
+
}
|
|
15
|
+
]
|
|
16
|
+
]
|
|
17
|
+
}
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# [1.1.0](https://github.com/jwulf/urban-pr-review-codefirst/compare/v1.0.0...v1.1.0) (2026-07-31)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **ci:** sync package-lock to @nanobpm/workflow@0.4.0 ([57aa919](https://github.com/jwulf/urban-pr-review-codefirst/commit/57aa919e4f5f1dbc2e9022cda19b2aa1594dff50)), closes [#1](https://github.com/jwulf/urban-pr-review-codefirst/issues/1)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* emit senior:pr-review so one reviewer serves both apps ([#1](https://github.com/jwulf/urban-pr-review-codefirst/issues/1)) ([0d3e39b](https://github.com/jwulf/urban-pr-review-codefirst/commit/0d3e39b112ce6cfb9d56874247f7d34d85e3e4fd))
|
|
12
|
+
|
|
13
|
+
# 1.0.0 (2026-07-31)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Features
|
|
17
|
+
|
|
18
|
+
* SQLite persistence, web UI, and automated release ([9e04da1](https://github.com/jwulf/urban-pr-review-codefirst/commit/9e04da1191e197ba2bb627d824e96fdb1a5a318c))
|
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -17,6 +17,152 @@ them (`convergence-loop.bpmn` + `workers/*/worker.ts`), code-first writes them
|
|
|
17
17
|
(`workflows/convergence-loop.ts`, with the record steps hosted in-process). See
|
|
18
18
|
[Persistence](#persistence) and [Frontend](#frontend) below.
|
|
19
19
|
|
|
20
|
+
## HOWTO: run agents that converge PRs for you, all day
|
|
21
|
+
|
|
22
|
+
### The problem this solves
|
|
23
|
+
|
|
24
|
+
Driving a PR to convergence is mostly *waiting*: open a review, wait 5–15 min for
|
|
25
|
+
the reviewer, address the comments, re-request, wait again — often ten rounds
|
|
26
|
+
deep, escalating to a human only when the reviewer is stuck. If a single agent
|
|
27
|
+
babysits one PR, it spends almost all of its time **idle-polling** a review that
|
|
28
|
+
hasn't landed yet. That is wasted wall-clock and a wasted worker slot.
|
|
29
|
+
|
|
30
|
+
This app inverts that. **The BPMN process the SDK derives owns the durable wait**
|
|
31
|
+
between rounds (a real `w.signal` message-catch event), so no agent is ever parked
|
|
32
|
+
holding a job slot while a review is pending. Instead you **hire a couple of agent
|
|
33
|
+
workers once**, and they pull `senior:pr-review` jobs from *whatever PR is ready
|
|
34
|
+
right now* — alternating across all in-flight reviews. Two agents can keep a dozen
|
|
35
|
+
PRs converging in parallel, and they only run when there is actual work to do.
|
|
36
|
+
|
|
37
|
+
Because the `review-round` task overrides its job type to **`senior:pr-review`**
|
|
38
|
+
(via `w.task("review-round", { jobType: "senior:pr-review" })`), the *same* hired
|
|
39
|
+
reviewer services both this code-first app and the model-first
|
|
40
|
+
[urban-pr-review](../urban-pr-review). Set it up by: **(1)** running this app,
|
|
41
|
+
**(2)** submitting PRs, and **(3)** hiring agent workers with
|
|
42
|
+
[`c8ctl nano`](https://github.com/jwulf/c8ctl-plugin-nano).
|
|
43
|
+
|
|
44
|
+
### 0. Prerequisites
|
|
45
|
+
|
|
46
|
+
- A running **Nano gateway/engine** (default `http://localhost:8080`). This is
|
|
47
|
+
what the app deploys to and what agents pull jobs from.
|
|
48
|
+
- **[Deno](https://deno.land/)** (to run this app) and the **c8ctl CLI with the
|
|
49
|
+
`nano` plugin** installed (to hire/run agents).
|
|
50
|
+
- On each machine that will *host an agent*: the **GitHub CLI** logged in
|
|
51
|
+
(`gh auth login`) or a `GITHUB_TOKEN`/`GH_TOKEN` in the environment, and the
|
|
52
|
+
agent harness itself — e.g. the **[Copilot CLI](https://github.com/github/copilot-cli)**
|
|
53
|
+
(`copilot`).
|
|
54
|
+
|
|
55
|
+
### 1. Install the app into your Nano IDE
|
|
56
|
+
|
|
57
|
+
Open the Nano console and **Projects → Import by reference**, pointing at this
|
|
58
|
+
app's folder (ADR 0041), or drop a `*.project-ref.json` next to your other
|
|
59
|
+
projects. `nano-ide.ext.json` marks it as an example. You can also just run it
|
|
60
|
+
standalone (next step) — the IDE import is only needed to launch/manage it from
|
|
61
|
+
the console.
|
|
62
|
+
|
|
63
|
+
### 2. Start the app
|
|
64
|
+
|
|
65
|
+
```sh
|
|
66
|
+
deno task start # → http://localhost:3000
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
That applies the DB migrations, deploys the derived flow, hosts the in-process
|
|
70
|
+
`w.run` record steps, serves the web UI at **<http://localhost:3000>**, and runs
|
|
71
|
+
the review-ready poller (which needs `GITHUB_TOKEN` to watch GitHub — without it,
|
|
72
|
+
re-reviews come only from the UI/CLI). Point it at a non-default gateway with
|
|
73
|
+
`NANOBPMN_BASE_URL`; change the port with `PR_REVIEW_PORT`.
|
|
74
|
+
|
|
75
|
+
### 3. Submit a PR
|
|
76
|
+
|
|
77
|
+
From the web UI, or from the CLI:
|
|
78
|
+
|
|
79
|
+
```sh
|
|
80
|
+
deno task submit https://github.com/owner/repo/pull/42 5 # 5 = maxRounds
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Each submitted PR starts one durable `convergence-loop` instance that parks until
|
|
84
|
+
an agent services its `senior:pr-review` round.
|
|
85
|
+
|
|
86
|
+
### 4. Hire an agent worker
|
|
87
|
+
|
|
88
|
+
An agent is a CLI harness (Copilot CLI here) turned into a Nano job worker. Hire a
|
|
89
|
+
profile whose **rank + capability** produce the `senior:pr-review` token this
|
|
90
|
+
flow's task emits:
|
|
91
|
+
|
|
92
|
+
```sh
|
|
93
|
+
c8ctl nano hire \
|
|
94
|
+
--name reviewer \
|
|
95
|
+
--rank senior \
|
|
96
|
+
--capabilities pr-review \
|
|
97
|
+
--command 'copilot -p - --allow-all-tools' \
|
|
98
|
+
--model <your-model>
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
- `--rank senior` + `--capabilities pr-review` makes the worker subscribe to the
|
|
102
|
+
`senior:pr-review` job type — exactly the token this flow's `review-round` task
|
|
103
|
+
emits (thanks to the SDK job-type override), so **one profile serves both apps.**
|
|
104
|
+
- `--command 'copilot -p - --allow-all-tools'` starts the Copilot CLI reading its
|
|
105
|
+
prompt from **stdin** (`-p -`). The harness pipes the whole job JSON (prompt +
|
|
106
|
+
`job.variables`: `prUrl`, `repo`, `prNumber`, `round`, `answer?`) to stdin; the
|
|
107
|
+
review-round instructions tell the agent how to read it and where to write its
|
|
108
|
+
result.
|
|
109
|
+
- **`--allow-all-tools` is the crucial flag.** Without it, Copilot pauses to ask
|
|
110
|
+
permission before each tool call — and an unattended worker has no human to
|
|
111
|
+
answer, so the job stalls. `--allow-all-tools` lets it run the whole round
|
|
112
|
+
non-interactively. (Pair with `--deny-tool` to blocklist specific tools.)
|
|
113
|
+
|
|
114
|
+
> ⚠️ **Only enable `--allow-all-tools` for code and hosts you trust.** It grants
|
|
115
|
+
> the agent unattended, broad permissions (shell, file writes, network). Each
|
|
116
|
+
> job runs in a throwaway per-job workspace (see below), but the worker still
|
|
117
|
+
> runs as your user on the host — don't point it at untrusted PRs on a shared
|
|
118
|
+
> machine. Use `--deny-tool` to narrow it, or a container sandbox for stronger
|
|
119
|
+
> isolation.
|
|
120
|
+
|
|
121
|
+
> If you'd rather not override the job type in the flow, you can instead leave the
|
|
122
|
+
> derived `convergence-loop:review-round` type and point a worker at it explicitly
|
|
123
|
+
> with `c8ctl nano work reviewer --job-type convergence-loop:review-round`. This
|
|
124
|
+
> app ships with the `senior:pr-review` override so it shares a reviewer with the
|
|
125
|
+
> model-first app out of the box.
|
|
126
|
+
|
|
127
|
+
### 5. Put the agent to work
|
|
128
|
+
|
|
129
|
+
```sh
|
|
130
|
+
c8ctl nano work reviewer # polls for senior:pr-review jobs until Ctrl-C
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Now every PR you submit gets picked up automatically. Start a **second** worker
|
|
134
|
+
(same command, another terminal or another machine) and the two alternate across
|
|
135
|
+
whichever PRs are ready — that is the idle-time you reclaim. Run more than one job
|
|
136
|
+
at once per worker with `--max-parallel 2`.
|
|
137
|
+
|
|
138
|
+
### Isolation — each job gets its own clean workspace
|
|
139
|
+
|
|
140
|
+
In the default **host mode** (`--sandbox none`), the worker provisions a
|
|
141
|
+
**throwaway, per-job workspace**: a fresh clone under `<state>/agent-runs/run-*`
|
|
142
|
+
checked out on the PR's head branch, exposed to the agent as `AGENT_WORKSPACE` /
|
|
143
|
+
`REPO_URL` / `REPO_BRANCH` / `REPO_REF`, and **reaped after the job**. So multiple
|
|
144
|
+
agents on one host don't step on each other. Host workers inherit *your*
|
|
145
|
+
`gh`/`GITHUB_TOKEN` login, so no extra auth is needed. Docker/podman sandboxes
|
|
146
|
+
exist (`--sandbox docker --image …`) for stronger isolation, but container-side
|
|
147
|
+
git provisioning is a later increment — container jobs don't clone yet, and don't
|
|
148
|
+
inherit your host login (pass credentials via `--secret-resolver host` /
|
|
149
|
+
`secretRefs`). For the review loop, **host mode is the recommended setup.**
|
|
150
|
+
|
|
151
|
+
### Run it across spare hardware (incl. a Raspberry Pi)
|
|
152
|
+
|
|
153
|
+
Nano ships ARM binaries (arm64/armv7/armv6), so the whole thing scales down nicely:
|
|
154
|
+
|
|
155
|
+
- **All-in-one:** run the gateway, this app, and one or two workers on your laptop.
|
|
156
|
+
- **Distributed:** run the **Nano gateway on a Raspberry Pi** (always-on, low
|
|
157
|
+
power), run this app anywhere, and put **agent workers on spare machines** — each
|
|
158
|
+
worker just needs the c8ctl CLI, the Copilot CLI logged in, and
|
|
159
|
+
`NANOBPMN_BASE_URL` pointed at the Pi. Add or remove workers at will; the BPMN
|
|
160
|
+
process holds all durable state, so workers are stateless and disposable.
|
|
161
|
+
|
|
162
|
+
The payoff: instead of one agent burning wall-clock polling a single PR, a small
|
|
163
|
+
pool of always-available workers keeps every open review converging — and idles to
|
|
164
|
+
zero cost when there's nothing to do.
|
|
165
|
+
|
|
20
166
|
## The flow
|
|
21
167
|
|
|
22
168
|
`workflows/convergence-loop.ts`:
|
|
@@ -35,8 +181,10 @@ loop:
|
|
|
35
181
|
```
|
|
36
182
|
|
|
37
183
|
- **`review-round`** is a `w.task` — an **external** worker. Point a coding-agent
|
|
38
|
-
harness at the job type `
|
|
39
|
-
|
|
184
|
+
harness at the job type `senior:pr-review` (e.g. a `c8ctl nano hire`d rank
|
|
185
|
+
`senior` + capability `pr-review` profile — the same one that services the
|
|
186
|
+
model-first app). The app never hosts or names it; it only owns the durable
|
|
187
|
+
orchestration around it.
|
|
40
188
|
- **`persist-*`** and **`persist-converged`** are `w.run` — app-hosted handlers.
|
|
41
189
|
`persist-round` returns `{ round: round + 1 }`; that return value (not an
|
|
42
190
|
ioMapping) is the loop's only state mutation.
|
|
@@ -55,7 +203,7 @@ the generated BPMN as `nano:shape` + `io.nanobpm.dataEnvelope` properties.
|
|
|
55
203
|
|
|
56
204
|
| Step | Derived job type / message |
|
|
57
205
|
| --- | --- |
|
|
58
|
-
| `review-round` (external) | `
|
|
206
|
+
| `review-round` (external) | `senior:pr-review` (overridden via `w.task("review-round", { jobType: "senior:pr-review" })`) |
|
|
59
207
|
| `persist-round` | `convergence-loop:persist-round` |
|
|
60
208
|
| `persist-escalation` | `convergence-loop:persist-escalation` |
|
|
61
209
|
| `persist-escalation-maxrounds` | `convergence-loop:persist-escalation-maxrounds` |
|
|
@@ -95,8 +243,8 @@ deno task purge
|
|
|
95
243
|
```
|
|
96
244
|
|
|
97
245
|
The reviewer itself is not started by `deno task start` — it is the external
|
|
98
|
-
`
|
|
99
|
-
|
|
246
|
+
`senior:pr-review` job. Host it with a coding-agent harness so the automated
|
|
247
|
+
review is fully decoupled from the durable orchestration.
|
|
100
248
|
|
|
101
249
|
Environment overrides: `PR_REVIEW_PORT` (default `3000`), `NANOBPMN_BASE_URL`
|
|
102
250
|
(gateway), `NANO_APP_DB_URL` (default `file:./app.db`), `NANO_PR_POLL_MS`
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
"$schema": "https://unpkg.com/@camunda/zeebe-element-templates-json-schema@0.44.0/resources/schema.json",
|
|
3
3
|
"id": "io.nanobpm.urban.pr-review-round-codefirst",
|
|
4
4
|
"name": "PR Review Round (agent, code-first)",
|
|
5
|
-
"description": "One decoupled review round serviced by an external agent (e.g. a Copilot instance via `c8ctl nano work`). The agent reads the latest review, addresses it, pushes, re-requests review, and returns a structured status. Mirrors the model-first template, bound to the
|
|
5
|
+
"description": "One decoupled review round serviced by an external agent (e.g. a Copilot instance via `c8ctl nano work`). The agent reads the latest review, addresses it, pushes, re-requests review, and returns a structured status. Mirrors the model-first template, bound to the shared `senior:pr-review` reviewer job type the flow now emits.",
|
|
6
6
|
"appliesTo": ["bpmn:Task"],
|
|
7
7
|
"elementType": { "value": "bpmn:ServiceTask" },
|
|
8
8
|
"properties": [
|
|
9
9
|
{
|
|
10
10
|
"type": "Hidden",
|
|
11
|
-
"value": "
|
|
11
|
+
"value": "senior:pr-review",
|
|
12
12
|
"binding": { "type": "zeebe:taskDefinition:type" }
|
|
13
13
|
},
|
|
14
14
|
{
|
package/deno.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"exclude": [".deno-cache/", "nano-generated/"]
|
|
7
7
|
},
|
|
8
8
|
"imports": {
|
|
9
|
-
"@nanobpm/workflow": "npm:@nanobpm/workflow@^0.
|
|
9
|
+
"@nanobpm/workflow": "npm:@nanobpm/workflow@^0.4.0",
|
|
10
10
|
"@nanobpm/domain": "./nano-generated/domain.ts",
|
|
11
11
|
"@nanobpm/data": "./nano-generated/data-sdk.ts",
|
|
12
12
|
"@nanobpm/app": "./nano-generated/app-pages.ts",
|