@operad-io/dev 0.1.1 → 0.3.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/README.md +1 -1
- package/dev.schema.json +53 -31
- package/package.json +9 -6
- package/skills/git/SKILL.md +70 -0
- package/skills/setup/SKILL.md +74 -0
- package/src/access-grants.ts +59 -0
- package/src/actions.ts +81 -17
- package/src/announce.ts +134 -17
- package/src/chat.ts +586 -36
- package/src/check-host.ts +111 -0
- package/src/check-load.ts +67 -0
- package/src/check.ts +45 -22
- package/src/clock.ts +29 -0
- package/src/clone-chat.ts +32 -0
- package/src/commands.ts +103 -34
- package/src/create-actions.ts +210 -0
- package/src/flaky.ts +45 -29
- package/src/flow-compiler.ts +156 -69
- package/src/followups.ts +20 -22
- package/src/gate.ts +254 -88
- package/src/git-state.ts +155 -0
- package/src/git.ts +92 -4
- package/src/index.ts +52 -6
- package/src/integrate.ts +162 -62
- package/src/integration-queue.ts +23 -10
- package/src/lock.ts +101 -5
- package/src/mainclone.ts +61 -5
- package/src/model-error.ts +70 -0
- package/src/model.ts +61 -35
- package/src/notcode.ts +51 -15
- package/src/places.ts +2 -2
- package/src/prepare.ts +7 -2
- package/src/project-flows.ts +135 -4
- package/src/project-settings.ts +110 -3
- package/src/register-requests.ts +121 -0
- package/src/repository-key.ts +4 -0
- package/src/rerun.ts +23 -7
- package/src/retry.ts +2 -12
- package/src/rework.ts +8 -0
- package/src/schedule.ts +342 -93
- package/src/service.ts +241 -185
- package/src/settings.ts +409 -65
- package/src/setup-git.ts +366 -0
- package/src/standing.ts +23 -6
- package/src/step-edge.ts +22 -0
- package/src/steps.ts +945 -179
- package/src/throughput.ts +4 -21
- package/src/timeouts.ts +10 -2
- package/src/views.ts +325 -86
- package/src/waits.ts +59 -0
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @operad-io/dev
|
|
2
2
|
|
|
3
|
-
**The dev plugin: plans and tasks on a repository.** Turns a request into planned work and follows each task through
|
|
3
|
+
**The dev plugin: plans and tasks on a repository.** Turns a request into planned work and follows each task through code, tests, review and merge, with you at the merge.
|
|
4
4
|
|
|
5
5
|
This package is part of [operad](https://github.com/operad-io/operad). Most people install only [`@operad-io/cli`](https://www.npmjs.com/package/@operad-io/cli).
|
|
6
6
|
|
package/dev.schema.json
CHANGED
|
@@ -61,10 +61,16 @@
|
|
|
61
61
|
"description": "One stage of a repository flow. A parameter left out falls back to its dev.json setting.",
|
|
62
62
|
"oneOf": [
|
|
63
63
|
{
|
|
64
|
-
"description": "A worker changes the task branch.",
|
|
64
|
+
"description": "A code stage: a worker changes the task branch.",
|
|
65
65
|
"type": "object",
|
|
66
66
|
"properties": {
|
|
67
|
-
"stage": {
|
|
67
|
+
"stage": {
|
|
68
|
+
"description": "The stage kind: code, or its older name work, which still loads.",
|
|
69
|
+
"oneOf": [
|
|
70
|
+
{ "const": "code" },
|
|
71
|
+
{ "const": "work", "description": "Older name of code; still loads.", "deprecated": true }
|
|
72
|
+
]
|
|
73
|
+
},
|
|
68
74
|
"use": { "description": "The harness step, such as radian/agent; unset uses the repository's worker.", "type": "string", "minLength": 1 },
|
|
69
75
|
"args": { "description": "Arguments for the harness step; unset uses the worker's own.", "type": "array", "items": { "type": "string" } },
|
|
70
76
|
"pool": { "description": "The pool this stage takes its workers from; unset is default. The name must be in pools.", "type": "string", "minLength": 1 },
|
|
@@ -77,10 +83,16 @@
|
|
|
77
83
|
"additionalProperties": false
|
|
78
84
|
},
|
|
79
85
|
{
|
|
80
|
-
"description": "
|
|
86
|
+
"description": "A test stage: commands run in a gate checkout of the task commit.",
|
|
81
87
|
"type": "object",
|
|
82
88
|
"properties": {
|
|
83
|
-
"stage": {
|
|
89
|
+
"stage": {
|
|
90
|
+
"description": "The stage kind: test, or its older name check, which still loads.",
|
|
91
|
+
"oneOf": [
|
|
92
|
+
{ "const": "test" },
|
|
93
|
+
{ "const": "check", "description": "Older name of test; still loads.", "deprecated": true }
|
|
94
|
+
]
|
|
95
|
+
},
|
|
84
96
|
"commands": { "description": "The shell lines to run; unset uses gate.commands.", "type": "array", "items": { "$ref": "#/$defs/checkCommand" } },
|
|
85
97
|
"rerun": { "description": "How many times a failed line list runs again; unset uses check.rerun.", "type": "integer", "minimum": 0 }
|
|
86
98
|
},
|
|
@@ -112,7 +124,7 @@
|
|
|
112
124
|
]
|
|
113
125
|
},
|
|
114
126
|
"flow": {
|
|
115
|
-
"description": "One repository flow: its stages, in order. At least one stage must be
|
|
127
|
+
"description": "One repository flow: its stages, in order. At least one stage must be test, review or human. A human stage asks a person; when it is last its merge goes to integrate, and when it is not it continues with the next stage.",
|
|
116
128
|
"type": "object",
|
|
117
129
|
"properties": {
|
|
118
130
|
"stages": { "type": "array", "minItems": 1, "items": { "$ref": "#/$defs/stage" } }
|
|
@@ -132,7 +144,7 @@
|
|
|
132
144
|
"minLength": 1
|
|
133
145
|
},
|
|
134
146
|
"remote": {
|
|
135
|
-
"description": "The git remote task branches are fetched from and pushed to.",
|
|
147
|
+
"description": "The git remote task branches are fetched from and pushed to. Leave it out when the repository has no remote: the local main branch is then the base, nothing is fetched or pushed, and a merge only moves the local main branch. A repository that has the default remote and no `remote` setting uses it.",
|
|
136
148
|
"type": "string",
|
|
137
149
|
"minLength": 1,
|
|
138
150
|
"default": "origin"
|
|
@@ -156,10 +168,20 @@
|
|
|
156
168
|
"deprecated": true
|
|
157
169
|
},
|
|
158
170
|
"concurrency": {
|
|
171
|
+
"title": "Tasks at once",
|
|
159
172
|
"description": "A cap on running tasks across every pool together. Each pool has its own cap: the sum of the counts of its workers, or the pool's own concurrency when that is smaller. This cap never raises a pool's cap; when the file does not set it, the pools' caps alone decide.",
|
|
160
173
|
"type": "integer",
|
|
161
174
|
"minimum": 1
|
|
162
175
|
},
|
|
176
|
+
"workIn": {
|
|
177
|
+
"title": "Work in",
|
|
178
|
+
"description": "Where a task's changes are made. branch (A branch in this folder): dev makes the task's branch in the main clone and the task works there, one task at a time; it cannot be combined with a concurrency above 1 or workers that add up to more than 1. worktree (A separate worktree): each task has its own worktree.",
|
|
179
|
+
"oneOf": [
|
|
180
|
+
{ "const": "branch", "title": "A branch in this folder" },
|
|
181
|
+
{ "const": "worktree", "title": "A separate worktree" }
|
|
182
|
+
],
|
|
183
|
+
"default": "worktree"
|
|
184
|
+
},
|
|
163
185
|
"sandbox": {
|
|
164
186
|
"description": "Deprecated and ignored; kept so settings written by an earlier version still validate.",
|
|
165
187
|
"type": "string",
|
|
@@ -171,10 +193,9 @@
|
|
|
171
193
|
"type": "object",
|
|
172
194
|
"properties": {
|
|
173
195
|
"use": {
|
|
174
|
-
"description": "The harness step, such as radian/agent.",
|
|
196
|
+
"description": "The harness step, such as claude/agent; unset uses the first enabled harness in the home (radian, claude, pi, codex), or radian/agent when none is enabled.",
|
|
175
197
|
"type": "string",
|
|
176
|
-
"minLength": 1
|
|
177
|
-
"default": "radian/agent"
|
|
198
|
+
"minLength": 1
|
|
178
199
|
},
|
|
179
200
|
"args": {
|
|
180
201
|
"description": "Extra arguments the harness step passes to its command.",
|
|
@@ -195,11 +216,7 @@
|
|
|
195
216
|
"exclusiveMinimum": 0
|
|
196
217
|
}
|
|
197
218
|
},
|
|
198
|
-
"additionalProperties": false
|
|
199
|
-
"default": {
|
|
200
|
-
"use": "radian/agent",
|
|
201
|
-
"args": []
|
|
202
|
-
}
|
|
219
|
+
"additionalProperties": false
|
|
203
220
|
},
|
|
204
221
|
"workers": {
|
|
205
222
|
"description": "The repository's workers, by name. At least one. Not allowed together with worker.",
|
|
@@ -250,7 +267,7 @@
|
|
|
250
267
|
}
|
|
251
268
|
},
|
|
252
269
|
"pools": {
|
|
253
|
-
"description": "Groups of workers by pool name. dev uses the pool default, which must be defined here, unless a
|
|
270
|
+
"description": "Groups of workers by pool name. dev uses the pool default, which must be defined here, unless a code stage names another pool; without pools, default holds every worker in the order written. A pool is a list of worker names, or an object with the list and a concurrency that caps the pool's running tasks below the sum of its workers' counts. Needs workers.",
|
|
254
271
|
"type": "object",
|
|
255
272
|
"minProperties": 1,
|
|
256
273
|
"additionalProperties": {
|
|
@@ -278,6 +295,13 @@
|
|
|
278
295
|
"minLength": 1,
|
|
279
296
|
"default": ".operad/worker-brief.md"
|
|
280
297
|
},
|
|
298
|
+
"skills": {
|
|
299
|
+
"title": "Skills for chats",
|
|
300
|
+
"description": "The skill directories this repository's chats read, relative to the repository and inside it. A path may be a directory with a SKILL.md, a directory whose direct subdirectories each have one (such as .agents/skills), or a .agents directory (such as .agents), whose skills directory is read the same way. Every skill directly inside such a directory is loaded, including one added later. Empty gives the chats no skills. Task workers do not get them.",
|
|
301
|
+
"type": "array",
|
|
302
|
+
"items": { "type": "string", "minLength": 1 },
|
|
303
|
+
"default": [".agents/skills"]
|
|
304
|
+
},
|
|
281
305
|
"prepare": {
|
|
282
306
|
"description": "Shell lines run in every checkout dev makes (the worker's worktree, the gate checkout for verify and review, the integration checkout) after it is created or moved to a new commit and before any step uses it, for example installing dependencies. They also run, in order, in the repository's main clone after a merge fast-forwarded it. Output goes to the step's log; a failing line fails the step with reason \"prepare failed\"; in the main clone a failing line is reported in the task's Changes and the fast-forward stays.",
|
|
283
307
|
"type": "array",
|
|
@@ -289,18 +313,21 @@
|
|
|
289
313
|
"type": "object",
|
|
290
314
|
"properties": {
|
|
291
315
|
"commands": {
|
|
316
|
+
"title": "Check commands",
|
|
292
317
|
"description": "The commands the verify step runs, in order, in a detached checkout of the task commit.",
|
|
293
318
|
"type": "array",
|
|
294
319
|
"items": { "$ref": "#/$defs/checkCommand" },
|
|
295
320
|
"default": []
|
|
296
321
|
},
|
|
297
322
|
"commandTimeoutSecs": {
|
|
323
|
+
"title": "Check timeout",
|
|
298
324
|
"description": "The longest one gate command may run, in seconds.",
|
|
299
325
|
"type": "number",
|
|
300
326
|
"exclusiveMinimum": 0,
|
|
301
327
|
"default": 1800
|
|
302
328
|
},
|
|
303
329
|
"stallSecs": {
|
|
330
|
+
"title": "Check stall limit",
|
|
304
331
|
"description": "How long a gate command, or an integration key command, may write nothing before dev stops its process group, in seconds. A stalled command fails the check with reason \"stall\" and goes to the worker; it is not rerun and is not a \"not the code\" wait. Unset turns the limit off.",
|
|
305
332
|
"type": "number",
|
|
306
333
|
"exclusiveMinimum": 0
|
|
@@ -377,12 +404,13 @@
|
|
|
377
404
|
"type": "object",
|
|
378
405
|
"properties": {
|
|
379
406
|
"use": {
|
|
380
|
-
"
|
|
407
|
+
"title": "Reviewer",
|
|
408
|
+
"description": "The harness step, such as claude/agent; unset uses the first enabled harness in the home (radian, claude, pi, codex), or radian/agent when none is enabled.",
|
|
381
409
|
"type": "string",
|
|
382
|
-
"minLength": 1
|
|
383
|
-
"default": "radian/agent"
|
|
410
|
+
"minLength": 1
|
|
384
411
|
},
|
|
385
412
|
"args": {
|
|
413
|
+
"title": "Reviewer arguments",
|
|
386
414
|
"description": "Extra arguments the harness step passes to its command.",
|
|
387
415
|
"type": "array",
|
|
388
416
|
"items": {
|
|
@@ -474,6 +502,7 @@
|
|
|
474
502
|
]
|
|
475
503
|
},
|
|
476
504
|
"timeoutSecs": {
|
|
505
|
+
"title": "Review timeout",
|
|
477
506
|
"description": "The longest a review may run, in seconds.",
|
|
478
507
|
"type": "number",
|
|
479
508
|
"exclusiveMinimum": 0,
|
|
@@ -485,6 +514,7 @@
|
|
|
485
514
|
"exclusiveMinimum": 0
|
|
486
515
|
},
|
|
487
516
|
"fixLevel": {
|
|
517
|
+
"title": "Reviewer rework threshold",
|
|
488
518
|
"description": "The lowest finding severity that fails the gate.",
|
|
489
519
|
"type": "string",
|
|
490
520
|
"enum": [
|
|
@@ -518,17 +548,7 @@
|
|
|
518
548
|
"default": 1000000
|
|
519
549
|
}
|
|
520
550
|
},
|
|
521
|
-
"additionalProperties": false
|
|
522
|
-
"default": {
|
|
523
|
-
"use": "radian/agent",
|
|
524
|
-
"args": [],
|
|
525
|
-
"timeoutSecs": 600,
|
|
526
|
-
"fixLevel": "major",
|
|
527
|
-
"followups": true,
|
|
528
|
-
"retrySecs": 120,
|
|
529
|
-
"maxFileDiffBytes": 200000,
|
|
530
|
-
"maxDiffBytes": 1000000
|
|
531
|
-
}
|
|
551
|
+
"additionalProperties": false
|
|
532
552
|
},
|
|
533
553
|
"integration": {
|
|
534
554
|
"description": "How the integrate step builds the candidate and lands it on main.",
|
|
@@ -579,7 +599,7 @@
|
|
|
579
599
|
"if [ -e \"$OPERAD_WORKTREE-gate\" ]; then git worktree remove --force \"$OPERAD_WORKTREE-gate\"; fi",
|
|
580
600
|
"git worktree prune",
|
|
581
601
|
"if git show-ref --verify --quiet \"refs/heads/work/$OPERAD_TASK\"; then git branch -D \"work/$OPERAD_TASK\"; fi",
|
|
582
|
-
"if git ls-remote --exit-code --heads \"$OPERAD_REMOTE\" \"work/$OPERAD_TASK\" >/dev/null; then git push \"$OPERAD_REMOTE\" --delete \"work/$OPERAD_TASK\"; else [ $? -eq 2 ]; fi"
|
|
602
|
+
"if [ -z \"$OPERAD_REMOTE\" ]; then :; elif git ls-remote --exit-code --heads \"$OPERAD_REMOTE\" \"work/$OPERAD_TASK\" >/dev/null; then git push \"$OPERAD_REMOTE\" --delete \"work/$OPERAD_TASK\"; else [ $? -eq 2 ]; fi"
|
|
583
603
|
]
|
|
584
604
|
}
|
|
585
605
|
},
|
|
@@ -590,7 +610,7 @@
|
|
|
590
610
|
"if [ -e \"$OPERAD_WORKTREE-gate\" ]; then git worktree remove --force \"$OPERAD_WORKTREE-gate\"; fi",
|
|
591
611
|
"git worktree prune",
|
|
592
612
|
"if git show-ref --verify --quiet \"refs/heads/work/$OPERAD_TASK\"; then git branch -D \"work/$OPERAD_TASK\"; fi",
|
|
593
|
-
"if git ls-remote --exit-code --heads \"$OPERAD_REMOTE\" \"work/$OPERAD_TASK\" >/dev/null; then git push \"$OPERAD_REMOTE\" --delete \"work/$OPERAD_TASK\"; else [ $? -eq 2 ]; fi"
|
|
613
|
+
"if [ -z \"$OPERAD_REMOTE\" ]; then :; elif git ls-remote --exit-code --heads \"$OPERAD_REMOTE\" \"work/$OPERAD_TASK\" >/dev/null; then git push \"$OPERAD_REMOTE\" --delete \"work/$OPERAD_TASK\"; else [ $? -eq 2 ]; fi"
|
|
594
614
|
]
|
|
595
615
|
}
|
|
596
616
|
},
|
|
@@ -601,6 +621,7 @@
|
|
|
601
621
|
"default": 2
|
|
602
622
|
},
|
|
603
623
|
"autoDefault": {
|
|
624
|
+
"title": "Auto for new plans",
|
|
604
625
|
"description": "The auto level a new plan starts at: off waits for you to start tasks, run starts them by itself, merge also merges a task whose review passed.",
|
|
605
626
|
"enum": ["off", "run", "merge"],
|
|
606
627
|
"default": "off"
|
|
@@ -622,6 +643,7 @@
|
|
|
622
643
|
}
|
|
623
644
|
},
|
|
624
645
|
"flows": {
|
|
646
|
+
"title": "Custom flows",
|
|
625
647
|
"description": "The repository's own flows, by name. An absent map runs the built-in default. A flow is an ordered list of stages; dev adds the worktree at the start and integrate and cleanup at the end. A plan or task chooses a flow with --flow, and a flow with no review skips review. A flow whose last stage is not human goes straight to integrate after it passes.",
|
|
626
648
|
"type": "object",
|
|
627
649
|
"additionalProperties": { "$ref": "#/$defs/flow" }
|
package/package.json
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@operad-io/dev",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./src/index.ts"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@operad-io/
|
|
10
|
-
"@operad-io/
|
|
11
|
-
"@operad-io/
|
|
12
|
-
"@operad-io/
|
|
9
|
+
"@operad-io/access-match": "0.3.0",
|
|
10
|
+
"@operad-io/chat": "0.3.0",
|
|
11
|
+
"@operad-io/engine": "0.3.0",
|
|
12
|
+
"@operad-io/pool": "0.3.0",
|
|
13
|
+
"@operad-io/review-grading": "0.3.0"
|
|
13
14
|
},
|
|
14
15
|
"devDependencies": {
|
|
15
|
-
"@operad-io/shell": "0.
|
|
16
|
+
"@operad-io/shell": "0.3.0",
|
|
17
|
+
"@operad-io/test-support": "0.0.0"
|
|
16
18
|
},
|
|
17
19
|
"description": "operad: the dev plugin, plans and tasks on a repository",
|
|
18
20
|
"repository": {
|
|
@@ -24,6 +26,7 @@
|
|
|
24
26
|
"files": [
|
|
25
27
|
"src",
|
|
26
28
|
"flows",
|
|
29
|
+
"skills",
|
|
27
30
|
"dev.schema.json",
|
|
28
31
|
"README.md",
|
|
29
32
|
"LICENSE"
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: setup-git
|
|
3
|
+
description: Set up git here. The first task in a folder that has no git, or on a machine that has none: install git if needed, then propose the first commit.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
I want a task in the folder {target} and operad has told me that git is missing or not set
|
|
7
|
+
up there. Your job is to get git ready so the task can start. Reply in the language I write
|
|
8
|
+
to you in. Use these words with me: "Set up git here" (在这里设置 git); do not use the words
|
|
9
|
+
repository, worktree, branch or remote unless I use them first.
|
|
10
|
+
|
|
11
|
+
Rules that hold throughout:
|
|
12
|
+
|
|
13
|
+
- Git is needed only to create a task. Chatting in a folder and changing its files need
|
|
14
|
+
none. You only get here because I asked for a task: never raise git before that.
|
|
15
|
+
- operad does not bundle git. When it must be installed, it is installed with the
|
|
16
|
+
system's own tool.
|
|
17
|
+
- Every command you run goes through an approval I see in Pending, one command at a time,
|
|
18
|
+
with a line saying what it does. Never run one around that, never chain several, and
|
|
19
|
+
never use sudo or an administrator prompt unless the command below needs it.
|
|
20
|
+
- You write nothing into {target} yourself: no `git init`, no `.gitignore`, no commit.
|
|
21
|
+
Approving the proposal does all of it.
|
|
22
|
+
|
|
23
|
+
1. Find out what is missing. Run `git --version`. If it prints a version, go to step 3. If
|
|
24
|
+
it fails with "command not found" or the system offers to install developer tools, git
|
|
25
|
+
is not installed: go to step 2. Do not run `git` inside {target} to find out.
|
|
26
|
+
|
|
27
|
+
2. Install git, with the command for this system, each as an approved pending item. Tell me
|
|
28
|
+
in one sentence what it does first; it may open a system window or ask for my password.
|
|
29
|
+
- macOS: `xcode-select --install` (Apple's command line tools; a window opens and I click
|
|
30
|
+
Install). When it ends, run `git --version` again.
|
|
31
|
+
- Windows: `winget install Git.Git`. Then I may have to close and reopen the app so it
|
|
32
|
+
finds git; check with `git --version`.
|
|
33
|
+
- Linux: the package manager of the distribution, found with `cat /etc/os-release`:
|
|
34
|
+
`sudo apt-get install -y git` (Debian, Ubuntu), `sudo dnf install -y git` (Fedora,
|
|
35
|
+
RHEL), `sudo pacman -S --noconfirm git` (Arch), `sudo zypper install -y git`
|
|
36
|
+
(openSUSE), `sudo apk add git` (Alpine).
|
|
37
|
+
If the tool is missing or fails, say what it printed and what I can do (download git
|
|
38
|
+
from https://git-scm.com/downloads), and stop. Do not try other ways.
|
|
39
|
+
|
|
40
|
+
3. Look at the folder, without changing anything. List what is in {target} (`ls`), and note
|
|
41
|
+
what must not go into a first commit: dependency folders (`node_modules`, `.venv`,
|
|
42
|
+
`target`, `vendor`), build output (`dist`, `build`, `.next`), secrets (`.env*`, `*.pem`,
|
|
43
|
+
`*.key`, `id_rsa*`), system files. If the folder already has a `.gitignore`, keep every
|
|
44
|
+
line of it.
|
|
45
|
+
|
|
46
|
+
4. Name and email. A commit needs a name and an email. Ask me, in one sentence, for the
|
|
47
|
+
name and email to put on the commits; offer the computer account's name as the default.
|
|
48
|
+
If you do not know them, propose without `identity`: the proposal prefills them from the
|
|
49
|
+
computer account and shows them in its review. When git already has an identity on this
|
|
50
|
+
machine the proposal says so and uses it; do not ask again.
|
|
51
|
+
|
|
52
|
+
5. Propose it. Call the operad `command` tool with plugin `bot`, verb `setup-git`,
|
|
53
|
+
arguments `{bot}` and `{target}`, and as input a JSON object: `{}` for the defaults, or
|
|
54
|
+
with only what you change:
|
|
55
|
+
|
|
56
|
+
{
|
|
57
|
+
"gitignore": "<the whole .gitignore text, your folder's own lines kept>",
|
|
58
|
+
"identity": { "name": "<name>", "email": "<email>" }
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
It makes a pending item titled "Set up git here" that shows the `.gitignore`, the list of
|
|
62
|
+
files the first commit would hold and the name and email. Nothing is written into the
|
|
63
|
+
folder or started until I approve it. With no input the command prints these steps again,
|
|
64
|
+
so always send at least `{}`. If it refuses, say what it names in plain words and fix it
|
|
65
|
+
(a `.gitignore` that lets a secret in, a folder that is my home folder or the top of a
|
|
66
|
+
disk, a folder inside another project: then tell me that project's folder).
|
|
67
|
+
|
|
68
|
+
6. Report. Say what the pending item holds: how many files, anything you left out and why,
|
|
69
|
+
the name and email. If it says there are more than 5000 files, tell me to look at the
|
|
70
|
+
`.gitignore` before I approve. After I approve, the task I asked for can be created.
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: setup-dev
|
|
3
|
+
description: Setup Dev. Set up operad's dev for one repository: read its CI and scripts, choose the checks and agents, and propose a .operad/dev.json.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Set up operad's dev for the repository at {target}. dev is operad's way of running coding
|
|
7
|
+
agents through verified flows (plan, work, verify, review, merge). Your job is to write a
|
|
8
|
+
correct `.operad/dev.json` for this repo and propose it. Do not change source code, do not
|
|
9
|
+
write the file yourself, do not commit, push or start anything. Reply in the language I write
|
|
10
|
+
to you in.
|
|
11
|
+
|
|
12
|
+
Reference, if you need a key's details: https://operad.io/docs/dev/ (the full key table)
|
|
13
|
+
and https://operad.io/llms.txt.
|
|
14
|
+
|
|
15
|
+
1. Look at the folder. If {target} has a `.git` entry, run `git remote -v` and find the
|
|
16
|
+
main branch name there. A folder with no git, a machine without the git program, and a
|
|
17
|
+
repository with no git remote are all fine: do not run `git` in a folder that is not a
|
|
18
|
+
repository, do not ask me about git, and leave `remote` out of the file. If {target} is
|
|
19
|
+
inside another git repository, tell me that repository's folder and stop. Check which
|
|
20
|
+
agents are on PATH: `claude`, `pi`, `radian`. When none is, operad's own pi is the agent.
|
|
21
|
+
|
|
22
|
+
2. Find this repo's checks. Read CI config (.github/workflows, .gitlab-ci.yml, ...), the
|
|
23
|
+
Makefile, package.json scripts, pyproject, Cargo.toml or whatever applies. Choose the
|
|
24
|
+
commands that CI runs to judge whether a change is good: tests, typecheck, lint, build.
|
|
25
|
+
Each must exit non-zero on failure. Order them fast to slow. Run each once on the
|
|
26
|
+
current checkout; if one already fails on main, tell me instead of hiding it. If the
|
|
27
|
+
repo has no checks, say so and leave `gate.commands` empty.
|
|
28
|
+
|
|
29
|
+
3. Find what a fresh checkout needs. Each task runs in a fresh checkout, so dependencies
|
|
30
|
+
are not there. Put the install step in `prepare` (for example
|
|
31
|
+
`bun install --frozen-lockfile` or `npm ci`), only if the repo needs one.
|
|
32
|
+
|
|
33
|
+
4. Ask me which way to work, before you write the file. Skip this question when {target} is
|
|
34
|
+
not a git repository: choose the first way without asking. Say it in my language and in plain
|
|
35
|
+
words, about what changes for me; do not use the words clone, worktree or concurrency, and
|
|
36
|
+
do not ask me to know them. Offer two ways:
|
|
37
|
+
- In my folder: the agent makes a new branch in this folder and works there, one thing at
|
|
38
|
+
a time. It is best for me not to edit the folder while it works.
|
|
39
|
+
- Separately: each piece of work gets its own separate folder, so several can go at once
|
|
40
|
+
and my own folder stays untouched.
|
|
41
|
+
If I am not sure, or do not answer, choose the first (a new branch in my folder).
|
|
42
|
+
|
|
43
|
+
5. Write the `.operad/dev.json` text. Use only keys that matter; keep it small. Use the
|
|
44
|
+
`workers` form, never the old `worker` form:
|
|
45
|
+
|
|
46
|
+
{
|
|
47
|
+
"name": "<repo name>",
|
|
48
|
+
"remote": "<remote, left out when the repository has none>",
|
|
49
|
+
"mainBranch": "<main branch>",
|
|
50
|
+
"workIn": "<branch or worktree, from my answer>",
|
|
51
|
+
"workers": { "<agent>": { "use": "<agent>/agent", "args": [] } },
|
|
52
|
+
"prepare": [ ... ],
|
|
53
|
+
"gate": { "commands": [ ... ], "commandTimeoutSecs": 1800 },
|
|
54
|
+
"reviewer": { "use": "<agent>/agent", "args": [] },
|
|
55
|
+
"autoDefault": "off"
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
- Workers and reviewer: use agents that are actually installed. If two or more are
|
|
59
|
+
installed, use a different one for the reviewer than for the worker. `use` is
|
|
60
|
+
`<plugin>/<step>`, such as `claude/agent`, `pi/agent`, `radian/agent`.
|
|
61
|
+
- `workIn` is `"branch"` for the first way and `"worktree"` for the second. Never write
|
|
62
|
+
those two words to me; they belong only in the file. With `"branch"`, leave out
|
|
63
|
+
`concurrency` (it is one at a time).
|
|
64
|
+
- Leave `autoDefault` at "off": nothing merges without me.
|
|
65
|
+
- Do not invent model names or flags. Leave `args` empty unless I give you some.
|
|
66
|
+
|
|
67
|
+
6. Propose it. Call the operad `command` tool with plugin `bot`, verb `setup-dev`,
|
|
68
|
+
arguments `{bot}` and `{target}`, and the `.operad/dev.json` text as its input. It makes
|
|
69
|
+
a pending item; nothing is turned on or written until I approve it in Pending. If it
|
|
70
|
+
refuses, fix what it names and call it again.
|
|
71
|
+
|
|
72
|
+
7. Report. Show me the `.operad/dev.json` you proposed, say in one line why you chose each
|
|
73
|
+
check command, worker and reviewer, and say which way of working I chose and what it means for me in a sentence, and list anything you were unsure about. Tell me
|
|
74
|
+
to commit `.operad/dev.json` after I approve it (operad reads it from the main clone).
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The repository's view of the target grants: list the outward targets a
|
|
3
|
+
* background run may write to without asking, and remove one. The data belongs
|
|
4
|
+
* to the access user layer (ADR 0025 D12); this action only reads and writes
|
|
5
|
+
* it through `@operad-io/access-match`, so the command line and the HTTP/MCP
|
|
6
|
+
* action see the same list.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import type { ActionTypeDefinition } from "@operad-io/engine";
|
|
10
|
+
import { isRecord } from "@operad-io/engine";
|
|
11
|
+
import { readTargetGrants, revokeTargetGrants, type TargetGrant } from "@operad-io/access-match";
|
|
12
|
+
|
|
13
|
+
function grantLine(grant: TargetGrant): string {
|
|
14
|
+
const at = Number.isFinite(grant.at) ? new Date(grant.at).toISOString() : "unknown time";
|
|
15
|
+
return `${grant.flow} ${grant.target} (${grant.kind}) by ${grant.by.via}:${grant.by.id} at ${at}`;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** The action that lists the target grants, or removes those of one target. */
|
|
19
|
+
export const accessAction: ActionTypeDefinition = {
|
|
20
|
+
name: "allow",
|
|
21
|
+
on: "repo",
|
|
22
|
+
args: {
|
|
23
|
+
type: "object",
|
|
24
|
+
properties: {
|
|
25
|
+
target: {
|
|
26
|
+
type: "string",
|
|
27
|
+
minLength: 1,
|
|
28
|
+
description: "The outward target to stop allowing; omit to list them.",
|
|
29
|
+
},
|
|
30
|
+
flow: {
|
|
31
|
+
type: "string",
|
|
32
|
+
minLength: 1,
|
|
33
|
+
description: "Only remove what this flow allows to the target.",
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
additionalProperties: false,
|
|
37
|
+
},
|
|
38
|
+
when() {
|
|
39
|
+
return true;
|
|
40
|
+
},
|
|
41
|
+
async run(ctx, args) {
|
|
42
|
+
const input = isRecord(args) ? args : {};
|
|
43
|
+
const target = typeof input["target"] === "string" ? input["target"] : undefined;
|
|
44
|
+
const flow = typeof input["flow"] === "string" ? input["flow"] : undefined;
|
|
45
|
+
if (target === undefined) {
|
|
46
|
+
const read = await readTargetGrants(ctx.home);
|
|
47
|
+
if (read.problem !== undefined) throw new Error(read.problem);
|
|
48
|
+
if (read.file.grants.length === 0) return "no always-allowed outward targets";
|
|
49
|
+
return read.file.grants.map(grantLine).join("\n");
|
|
50
|
+
}
|
|
51
|
+
const removed = await revokeTargetGrants(ctx.home, target, flow);
|
|
52
|
+
if (removed === 0) {
|
|
53
|
+
return flow === undefined
|
|
54
|
+
? `no always-allowed target "${target}"`
|
|
55
|
+
: `no always-allowed target "${target}" for the flow "${flow}"`;
|
|
56
|
+
}
|
|
57
|
+
return `removed ${removed} always-allowed target${removed === 1 ? "" : "s"} for "${target}"`;
|
|
58
|
+
},
|
|
59
|
+
};
|