@voidlabs.gg/voidshift-agents 0.0.0-stage → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/README.md +136 -2
- package/dist/config.d.ts +60 -0
- package/dist/config.js +98 -0
- package/dist/control.d.ts +25 -0
- package/dist/control.js +711 -0
- package/dist/engine.d.ts +22 -0
- package/dist/engine.js +95 -0
- package/dist/git.d.ts +30 -0
- package/dist/git.js +136 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +1171 -0
- package/dist/keychain.d.ts +3 -0
- package/dist/keychain.js +19 -0
- package/dist/launchd.d.ts +7 -0
- package/dist/launchd.js +68 -0
- package/dist/linear.d.ts +33 -0
- package/dist/linear.js +122 -0
- package/dist/manage.d.ts +18 -0
- package/dist/manage.js +120 -0
- package/dist/memory.d.ts +2 -0
- package/dist/memory.js +37 -0
- package/dist/names.d.ts +8 -0
- package/dist/names.js +26 -0
- package/dist/repos.d.ts +1 -0
- package/dist/repos.js +45 -0
- package/dist/runner.d.ts +23 -0
- package/dist/runner.js +432 -0
- package/dist/state.d.ts +63 -0
- package/dist/state.js +107 -0
- package/dist/types.d.ts +51 -0
- package/dist/types.js +3 -0
- package/dist/workflow.d.ts +52 -0
- package/dist/workflow.js +111 -0
- package/pack/vs-dev/SKILL.md +51 -0
- package/pack/vs-plan/SKILL.md +140 -0
- package/pack/vs-plan-review/SKILL.md +63 -0
- package/pack/vs-publish/SKILL.md +45 -0
- package/pack/vs-qa/SKILL.md +72 -0
- package/package.json +50 -4
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
|
@@ -1,3 +1,137 @@
|
|
|
1
|
-
#
|
|
1
|
+
# VoidShift
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
One CLI for the Void dev tools. Install it once, run `vsf` (short for
|
|
4
|
+
`voidshift`), pick the tools you want, and it sets each one up with good
|
|
5
|
+
defaults you can change. Everything setup does can be seen and changed later
|
|
6
|
+
from the command line.
|
|
7
|
+
|
|
8
|
+
> Early release. macOS only for now; Windows and Linux are next.
|
|
9
|
+
|
|
10
|
+
```sh
|
|
11
|
+
npm i -g @voidlabs.gg/voidshift
|
|
12
|
+
vsf setup # pick tools and set them up
|
|
13
|
+
vsf setup --defaults # take every default, ask only what has none
|
|
14
|
+
vsf # what every tool is doing (first run: setup)
|
|
15
|
+
vsf help # every command; vsf <tool> help for a tool's
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Tools
|
|
19
|
+
|
|
20
|
+
| Tool | What it does |
|
|
21
|
+
|---|---|
|
|
22
|
+
| `awake` | Keeps your Mac running, on battery and with the lid closed, and puts sleep back when the battery runs low, the Mac gets hot, a timer ends or it restarts |
|
|
23
|
+
| `agents` | Agents for Claude Code and Codex, and workflows that run them in the background off your Linear cards |
|
|
24
|
+
| `memory` | A markdown vault of notes, recalled into Claude Code and Codex before every prompt |
|
|
25
|
+
|
|
26
|
+
### awake
|
|
27
|
+
|
|
28
|
+
```sh
|
|
29
|
+
vsf awake on [--until 7am | --for 6h] [--battery 20]
|
|
30
|
+
vsf awake status
|
|
31
|
+
vsf awake logs [-f] # what the watchdog decided
|
|
32
|
+
vsf awake off
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Setup asks for your Mac password once to add a rule that allows only
|
|
36
|
+
`pmset -a disablesleep 0|1`. A small watchdog checks every minute and turns
|
|
37
|
+
sleep back on when it should. Keep a closed Mac out of a bag: with no airflow
|
|
38
|
+
it runs hot.
|
|
39
|
+
|
|
40
|
+
### agents
|
|
41
|
+
|
|
42
|
+
Five agents, installed into Claude Code (and Codex if you use it):
|
|
43
|
+
|
|
44
|
+
| Agent | What it does |
|
|
45
|
+
|---|---|
|
|
46
|
+
| Plan | plans a Linear card against the code |
|
|
47
|
+
| Plan review | checks a plan before it is published |
|
|
48
|
+
| Publish | posts the plan to the card and hands it over |
|
|
49
|
+
| Dev | implements the plan and opens a draft PR |
|
|
50
|
+
| QA | CI, then code review, then a usability check in a headless browser |
|
|
51
|
+
|
|
52
|
+
Use them yourself (`/vs-plan ENG-123` in Claude Code), or let a **workflow**
|
|
53
|
+
run them. A workflow starts when one of your Linear cards gets a label, runs
|
|
54
|
+
agents in order in a project (a repo on your Mac), and sends work back to the
|
|
55
|
+
step that made it when a check fails:
|
|
56
|
+
|
|
57
|
+
```
|
|
58
|
+
when ENG + vs-plan: Dev → QA in tether-relay
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
The runner checks Linear every minute, works in its own copy of the repo so
|
|
62
|
+
your checkout is never touched, and keeps two labels on the card as it goes: the
|
|
63
|
+
stage (`vs-planning`, `vs-plan-review`, `vs-dev`, `vs-qa`, then `vs-qa-verified`
|
|
64
|
+
or `vs-parked`) and the round (`vs-v1`, `vs-v2`). On Linear it posts the plan and
|
|
65
|
+
one final comment, nothing in between.
|
|
66
|
+
|
|
67
|
+
```sh
|
|
68
|
+
vsf agents status # runner, the card in progress, parked cards
|
|
69
|
+
vsf agents run ENG-123 [--from qa] # run one card now, in this terminal
|
|
70
|
+
vsf agents start | stop | restart # the background runner (stop cancels the card)
|
|
71
|
+
vsf agents pause | resume # pick up no new cards for a while
|
|
72
|
+
vsf agents cancel | retry ENG-123 # stop a card, or queue a parked one again
|
|
73
|
+
vsf agents runs | show ENG-123 # what happened, step by step
|
|
74
|
+
vsf agents logs [ENG-123] [-f] # the runner log, or a card's step logs
|
|
75
|
+
vsf agents workflows # workflows in the order they match
|
|
76
|
+
vsf agents workflow add|edit|show|rename|move|rm
|
|
77
|
+
vsf agents projects | project add|edit|show|rename|rm
|
|
78
|
+
vsf agents homes | link DIR # where the agents are installed
|
|
79
|
+
vsf agents clean # old worktrees and run logs
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### memory
|
|
83
|
+
|
|
84
|
+
A folder of markdown notes, one topic per note, with an `INDEX.md` holding one
|
|
85
|
+
keyword line per note. Before every prompt, the words you type are matched
|
|
86
|
+
against the index and the best notes are handed to Claude Code or Codex. A
|
|
87
|
+
`memory` skill tells them how to read the vault and when to write a note:
|
|
88
|
+
decisions and their why, dead ends, things that are not obvious from the code.
|
|
89
|
+
Background agents read it for each card and save what they learn.
|
|
90
|
+
|
|
91
|
+
```sh
|
|
92
|
+
vsf memory status # the vault and where recall is on
|
|
93
|
+
vsf memory search WORDS # notes recall would bring up
|
|
94
|
+
vsf memory try "a prompt" # exactly what recall would add to that prompt
|
|
95
|
+
vsf memory check # notes missing from INDEX.md, broken links
|
|
96
|
+
vsf memory on | off # turn recall on or off
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Setup creates a vault at `~/memory` or uses one you already have. Codex asks you
|
|
100
|
+
to trust the recall hook once: run `/hooks` in Codex.
|
|
101
|
+
|
|
102
|
+
## What to know
|
|
103
|
+
|
|
104
|
+
- **Your own logins.** Agents run the official `claude` and `codex` CLIs you
|
|
105
|
+
already use, signed in with your own account. VoidShift never reads or
|
|
106
|
+
stores those credentials. The Linear API key for the runner lives in your
|
|
107
|
+
macOS Keychain.
|
|
108
|
+
- **Trust.** The Dev agent can run shell commands inside its copy of the repo
|
|
109
|
+
so it can install and test. Review its pull requests like any other.
|
|
110
|
+
- **Your config** lives in `~/.config/voidshift`.
|
|
111
|
+
|
|
112
|
+
```sh
|
|
113
|
+
vsf doctor # check everything is set up, and whether an update is out
|
|
114
|
+
vsf config [tool] # every saved setting
|
|
115
|
+
vsf config set KEY VALUE # e.g. vsf config set agents.models.dev opus
|
|
116
|
+
vsf config edit [tool] # edit settings in $EDITOR, checked before saving
|
|
117
|
+
vsf update # update VoidShift and every tool you added
|
|
118
|
+
vsf tools # list tools
|
|
119
|
+
|
|
120
|
+
Read commands take `--json`. Workflow and project names can be shortened to
|
|
121
|
+
any unique start, e.g. `tether` for `tether-relay-build`.
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## Development
|
|
125
|
+
|
|
126
|
+
```sh
|
|
127
|
+
pnpm install
|
|
128
|
+
pnpm test
|
|
129
|
+
node packages/cli/src/main.ts
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
Node 22.18 or newer runs the TypeScript sources directly. Releases are cut by
|
|
133
|
+
pushing a `v*` tag; CI publishes every package at that version.
|
|
134
|
+
|
|
135
|
+
## License
|
|
136
|
+
|
|
137
|
+
Apache-2.0. See [LICENSE](LICENSE).
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { Engine } from './engine.ts';
|
|
2
|
+
export type StepId = 'vs-plan' | 'vs-plan-review' | 'vs-publish' | 'vs-dev' | 'vs-qa';
|
|
3
|
+
export type Output = 'plan' | 'verdict' | 'commits' | 'publish';
|
|
4
|
+
export declare const STEPS: Record<StepId, {
|
|
5
|
+
label: string;
|
|
6
|
+
output: Output;
|
|
7
|
+
hint: string;
|
|
8
|
+
}>;
|
|
9
|
+
export declare const isProducer: (s: StepId) => boolean;
|
|
10
|
+
export declare const AGENTS: Record<string, {
|
|
11
|
+
label: string;
|
|
12
|
+
hint: string;
|
|
13
|
+
}>;
|
|
14
|
+
export declare const visibleAgents: () => string[];
|
|
15
|
+
export declare const stepEnabled: (step: StepId, enabled: string[]) => boolean;
|
|
16
|
+
export interface Trigger {
|
|
17
|
+
source: 'linear';
|
|
18
|
+
team: string;
|
|
19
|
+
label: string;
|
|
20
|
+
}
|
|
21
|
+
export interface Project {
|
|
22
|
+
path: string;
|
|
23
|
+
base?: string;
|
|
24
|
+
}
|
|
25
|
+
export interface Workflow {
|
|
26
|
+
triggers: Trigger[];
|
|
27
|
+
steps: StepId[];
|
|
28
|
+
maxRounds: number;
|
|
29
|
+
project: string;
|
|
30
|
+
}
|
|
31
|
+
export interface AgentsConfig {
|
|
32
|
+
engine: Engine;
|
|
33
|
+
models: {
|
|
34
|
+
dev?: string;
|
|
35
|
+
review?: string;
|
|
36
|
+
};
|
|
37
|
+
projects: Record<string, Project>;
|
|
38
|
+
workflows: Record<string, Workflow>;
|
|
39
|
+
reviewState: string;
|
|
40
|
+
timeoutMinutes: number;
|
|
41
|
+
homes: {
|
|
42
|
+
kind: 'claude' | 'codex';
|
|
43
|
+
dir: string;
|
|
44
|
+
}[];
|
|
45
|
+
enabled: string[];
|
|
46
|
+
}
|
|
47
|
+
export declare const TEMPLATES: Record<string, {
|
|
48
|
+
steps: StepId[];
|
|
49
|
+
maxRounds: number;
|
|
50
|
+
}>;
|
|
51
|
+
export declare const DEFAULTS: AgentsConfig;
|
|
52
|
+
export declare const agentsDir: (configDir: string) => string;
|
|
53
|
+
export declare const hasWork: (workflow: Pick<Workflow, "steps">) => boolean;
|
|
54
|
+
export declare const hasProducer: (workflow: Pick<Workflow, "steps">) => boolean;
|
|
55
|
+
export declare const describeSteps: (steps: StepId[]) => string;
|
|
56
|
+
export declare const describeTriggers: (triggers: Trigger[]) => string;
|
|
57
|
+
export declare const describeWorkflow: (c: Workflow) => string;
|
|
58
|
+
export declare function migrate(saved: Record<string, any>): Partial<AgentsConfig>;
|
|
59
|
+
export declare function readAgentsConfig(configDir: string): AgentsConfig;
|
|
60
|
+
export declare function writeAgentsConfig(configDir: string, config: AgentsConfig): void;
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
2
|
+
import { basename, join } from 'node:path';
|
|
3
|
+
export const STEPS = {
|
|
4
|
+
'vs-plan': { label: 'Plan', output: 'plan', hint: 'writes a plan and posts it to the card' },
|
|
5
|
+
'vs-plan-review': { label: 'Plan review', output: 'verdict', hint: 'checks the plan; on FIX the workflow goes back to Plan' },
|
|
6
|
+
'vs-publish': { label: 'Publish', output: 'publish', hint: 'creates and pushes the branch for the card' },
|
|
7
|
+
'vs-dev': { label: 'Dev', output: 'commits', hint: 'implements the plan, commits, opens a draft PR' },
|
|
8
|
+
'vs-qa': { label: 'QA', output: 'verdict', hint: 'CI, then code review, then a usability check; on FIX back to Dev' },
|
|
9
|
+
};
|
|
10
|
+
// Steps a failed verdict can send work back to.
|
|
11
|
+
export const isProducer = (s) => STEPS[s].output === 'plan' || STEPS[s].output === 'commits';
|
|
12
|
+
// The agents in the pack, as setup describes them.
|
|
13
|
+
export const AGENTS = {
|
|
14
|
+
'vs-plan': { label: 'Plan', hint: 'plans a card against the code' },
|
|
15
|
+
'vs-plan-review': { label: 'Plan review', hint: 'checks a plan before it is published' },
|
|
16
|
+
'vs-publish': { label: 'Publish', hint: 'posts the plan to Linear and hands the card over' },
|
|
17
|
+
'vs-dev': { label: 'Dev', hint: 'implements the plan and opens a draft PR' },
|
|
18
|
+
'vs-qa': { label: 'QA', hint: 'CI, then code review, then a usability check' },
|
|
19
|
+
};
|
|
20
|
+
export const visibleAgents = () => Object.keys(AGENTS);
|
|
21
|
+
export const stepEnabled = (step, enabled) => enabled.includes(step);
|
|
22
|
+
// Step lists to start a workflow from.
|
|
23
|
+
export const TEMPLATES = {
|
|
24
|
+
build: { steps: ['vs-dev', 'vs-qa'], maxRounds: 3 },
|
|
25
|
+
'plan-and-build': { steps: ['vs-plan', 'vs-plan-review', 'vs-dev', 'vs-qa'], maxRounds: 3 },
|
|
26
|
+
'qa-only': { steps: ['vs-qa'], maxRounds: 1 },
|
|
27
|
+
};
|
|
28
|
+
export const DEFAULTS = {
|
|
29
|
+
engine: 'claude',
|
|
30
|
+
models: { dev: 'opus', review: 'sonnet' },
|
|
31
|
+
projects: {},
|
|
32
|
+
workflows: {},
|
|
33
|
+
reviewState: 'In Review',
|
|
34
|
+
timeoutMinutes: 45,
|
|
35
|
+
homes: [],
|
|
36
|
+
enabled: [],
|
|
37
|
+
};
|
|
38
|
+
export const agentsDir = (configDir) => join(configDir, 'agents');
|
|
39
|
+
const configPath = (configDir) => join(agentsDir(configDir), 'config.json');
|
|
40
|
+
export const hasWork = (workflow) => workflow.steps.some((s) => STEPS[s].output === 'commits');
|
|
41
|
+
export const hasProducer = (workflow) => workflow.steps.some(isProducer);
|
|
42
|
+
export const describeSteps = (steps) => steps.map((s) => STEPS[s].label).join(' → ');
|
|
43
|
+
export const describeTriggers = (triggers) => triggers.map((t) => `${t.team} + ${t.label}`).join(', ');
|
|
44
|
+
export const describeWorkflow = (c) => `when ${describeTriggers(c.triggers)}: ${describeSteps(c.steps)} in ${c.project}`;
|
|
45
|
+
// Step ids that were folded into QA.
|
|
46
|
+
const RENAMED = { 'vs-qa-review': 'vs-qa', ci: null, 'vs-qa-ui': null };
|
|
47
|
+
const migrateStepList = (steps) => {
|
|
48
|
+
const mapped = steps.map((s) => (s in RENAMED ? RENAMED[s] : s)).filter((s) => !!s);
|
|
49
|
+
return mapped.filter((s, i) => !(s === 'vs-qa' && mapped[i - 1] === 'vs-qa'));
|
|
50
|
+
};
|
|
51
|
+
// Earlier shapes: a team mapped straight to a repo, then separate triggers
|
|
52
|
+
// pointing at a workflow and a project. Both become workflows that own triggers.
|
|
53
|
+
// Saved settings used to call workflows "chains".
|
|
54
|
+
export function migrate(saved) {
|
|
55
|
+
const { repos, uiUrls: _uiUrls, maxRounds: _max, triggers, chains, ...rest } = saved;
|
|
56
|
+
const previous = saved.workflows ?? chains ?? {};
|
|
57
|
+
const projects = { ...(saved.projects ?? {}) };
|
|
58
|
+
const oldTriggers = [...(triggers ?? [])];
|
|
59
|
+
for (const [team, path] of Object.entries((repos ?? {}))) {
|
|
60
|
+
const name = basename(path);
|
|
61
|
+
projects[name] = { path };
|
|
62
|
+
oldTriggers.push({ team, label: 'vs-plan', chain: 'build', project: name });
|
|
63
|
+
}
|
|
64
|
+
// The browser check is gone, so its URL and model are dead settings.
|
|
65
|
+
for (const p of Object.values(projects))
|
|
66
|
+
delete p.uiUrl;
|
|
67
|
+
const models = rest.models && { ...rest.models };
|
|
68
|
+
if (models)
|
|
69
|
+
delete models.ui;
|
|
70
|
+
const workflows = {};
|
|
71
|
+
for (const [name, w] of Object.entries(previous)) {
|
|
72
|
+
if (w.project)
|
|
73
|
+
workflows[name] = { ...w, steps: migrateStepList(w.steps) };
|
|
74
|
+
}
|
|
75
|
+
for (const t of oldTriggers) {
|
|
76
|
+
const base = t.chain === 'review-only' ? 'qa-only' : t.chain;
|
|
77
|
+
const steps = TEMPLATES[base]?.steps ?? migrateStepList(previous[t.chain]?.steps ?? []);
|
|
78
|
+
if (!steps.length)
|
|
79
|
+
continue;
|
|
80
|
+
const name = `${t.project}-${base}`;
|
|
81
|
+
const workflow = workflows[name] ?? { triggers: [], steps, maxRounds: TEMPLATES[base]?.maxRounds ?? previous[t.chain]?.maxRounds ?? 3, project: t.project };
|
|
82
|
+
workflow.triggers.push({ source: 'linear', team: t.team, label: t.label });
|
|
83
|
+
workflows[name] = workflow;
|
|
84
|
+
}
|
|
85
|
+
const enabled = [...new Set((saved.enabled ?? []).map((a) => (a in RENAMED ? RENAMED[a] : a)).filter(Boolean))];
|
|
86
|
+
return { ...rest, ...(models ? { models } : {}), projects, workflows, enabled };
|
|
87
|
+
}
|
|
88
|
+
export function readAgentsConfig(configDir) {
|
|
89
|
+
const path = configPath(configDir);
|
|
90
|
+
if (!existsSync(path))
|
|
91
|
+
return structuredClone(DEFAULTS);
|
|
92
|
+
const saved = migrate(JSON.parse(readFileSync(path, 'utf8')));
|
|
93
|
+
return { ...structuredClone(DEFAULTS), ...saved, models: { ...DEFAULTS.models, ...saved.models } };
|
|
94
|
+
}
|
|
95
|
+
export function writeAgentsConfig(configDir, config) {
|
|
96
|
+
mkdirSync(agentsDir(configDir), { recursive: true });
|
|
97
|
+
writeFileSync(configPath(configDir), JSON.stringify(config, null, 2) + '\n');
|
|
98
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type Current, type RunEntry } from './state.ts';
|
|
2
|
+
import type { Check, ToolCommand, ToolContext } from './types.ts';
|
|
3
|
+
export declare function parseAge(input: string): number | null;
|
|
4
|
+
export declare function formatDuration(ms: number): string;
|
|
5
|
+
export declare function stampDate(stamp: string): Date;
|
|
6
|
+
export declare function countRounds(steps: {
|
|
7
|
+
result?: string;
|
|
8
|
+
}[]): number;
|
|
9
|
+
export declare const isInterrupted: (e: RunEntry, live: Current | null) => boolean;
|
|
10
|
+
export declare function formatRunLine(e: RunEntry, now?: number, live?: Current | null): string;
|
|
11
|
+
export declare function scanRunnerErrors(text: string, now: number): {
|
|
12
|
+
count: number;
|
|
13
|
+
last: string;
|
|
14
|
+
};
|
|
15
|
+
export declare function parsePlistArgs(plist: string): string[];
|
|
16
|
+
export declare const controlUsage: Record<string, string>;
|
|
17
|
+
export interface CancelDeps {
|
|
18
|
+
ours: (pid: number) => boolean;
|
|
19
|
+
kill: (pid: number, signal: 'SIGTERM' | 'SIGKILL') => void;
|
|
20
|
+
sleep: (ms: number) => Promise<void>;
|
|
21
|
+
cancelCard: (card: string, label: string) => Promise<boolean>;
|
|
22
|
+
}
|
|
23
|
+
export declare function cancelCurrent(ctx: ToolContext, c: Current, deps: CancelDeps): Promise<void>;
|
|
24
|
+
export declare const controlCommands: Record<string, ToolCommand>;
|
|
25
|
+
export declare function controlChecks(ctx: ToolContext): Promise<Check[]>;
|