@srobroek/pi-worktrunk-merge-policy 0.0.0-stage → 0.7.2
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/CHANGELOG.md +99 -0
- package/LICENSE +202 -0
- package/README.md +135 -2
- package/extensions/worktrunk.js +3110 -0
- package/package.json +36 -4
- package/skills/worktrunk-preflight/SKILL.md +34 -0
- package/skills/worktrunk-preflight/preflight.py +880 -0
- package/skills/worktrunk-preflight/test_preflight.py +378 -0
- package/skills/worktrunk-worktrees/SKILL.md +58 -0
- package/skills/worktrunk-worktrees/references/pitfalls.md +7 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
## worktrunk [0.7.2](https://github.com/srobroek/harness-plugins/compare/worktrunk--v0.7.1...worktrunk--v0.7.2) (2026-11-24)
|
|
2
|
+
|
|
3
|
+
## worktrunk [0.7.1](https://github.com/srobroek/harness-plugins/compare/worktrunk--v0.7.0...worktrunk--v0.7.1) (2026-11-23)
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
* **whats-new:** grant MCP tools to the whats-new research agent ([8ae7fe0](https://github.com/srobroek/harness-plugins/commit/8ae7fe05c65e2df2f53ebf944c8f9bd5b7625cf9))
|
|
8
|
+
|
|
9
|
+
## worktrunk [0.7.0](https://github.com/srobroek/harness-plugins/compare/worktrunk--v0.6.1...worktrunk--v0.7.0) (2026-11-23)
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* **trunk-dev:** enforce commit and push gates and merge advisories on pi ([a96175c](https://github.com/srobroek/harness-plugins/commit/a96175c53d82b6ff71a8c9b2f55c43426983f639))
|
|
14
|
+
* **worktrunk:** add pi merge gate, wt switch timeout and preflight tool ([5b5ef87](https://github.com/srobroek/harness-plugins/commit/5b5ef87b10fe4108d3b75ea4d2c0d0fef690c2ff))
|
|
15
|
+
|
|
16
|
+
## worktrunk [0.6.1](https://github.com/srobroek/harness-plugins/compare/worktrunk--v0.6.0...worktrunk--v0.6.1) (2026-11-23)
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* make every plugin agent's OMP form correct ([96b7bfe](https://github.com/srobroek/harness-plugins/commit/96b7bfea3c35017b34a28f59e81fb059f6c68a24))
|
|
21
|
+
|
|
22
|
+
## worktrunk [0.6.0](https://github.com/srobroek/harness-plugins/compare/worktrunk--v0.5.1...worktrunk--v0.6.0) (2026-11-22)
|
|
23
|
+
|
|
24
|
+
### Features
|
|
25
|
+
|
|
26
|
+
* **delivery:** ship the orchestrator agent ([#121](https://github.com/srobroek/harness-plugins/issues/121)) ([53f33c0](https://github.com/srobroek/harness-plugins/commit/53f33c016315732220a7c87066267931ee87f514))
|
|
27
|
+
|
|
28
|
+
## worktrunk [0.5.1](https://github.com/srobroek/harness-plugins/compare/worktrunk--v0.5.0...worktrunk--v0.5.1) (2026-11-22)
|
|
29
|
+
|
|
30
|
+
### Bug Fixes
|
|
31
|
+
|
|
32
|
+
* **subagent-worktree:** drop inherited command-scope git config before pinning ([87b5a17](https://github.com/srobroek/harness-plugins/commit/87b5a1797a290420239d374ebcda92aa6685b35d)), closes [#96](https://github.com/srobroek/harness-plugins/issues/96)
|
|
33
|
+
* **subagent-worktree:** drop inherited repository selectors from the hardened git env ([60c5723](https://github.com/srobroek/harness-plugins/commit/60c572351ff7a6f3e6b7c748e71eca45f2820196)), closes [#96](https://github.com/srobroek/harness-plugins/issues/96)
|
|
34
|
+
* **subagent-worktree:** refuse every git transport in the hardened env ([c1c5888](https://github.com/srobroek/harness-plugins/commit/c1c58887cb92012932a9f58c69616f51af5ca983)), closes [#79](https://github.com/srobroek/harness-plugins/issues/79) [#79](https://github.com/srobroek/harness-plugins/issues/79)
|
|
35
|
+
* **worktrunk:** harden the git env and skip project hooks ([5adff10](https://github.com/srobroek/harness-plugins/commit/5adff10b20abf498a702b767ec61448c15f86858))
|
|
36
|
+
|
|
37
|
+
# Changelog
|
|
38
|
+
|
|
39
|
+
## [0.5.0](https://github.com/srobroek/opencode-plugins/compare/worktrunk--v0.4.2...worktrunk--v0.5.0) (2026-11-20)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
### Features
|
|
43
|
+
|
|
44
|
+
* plugin scan fixes, wider agent access and the plugin-audit plugin ([9c71525](https://github.com/srobroek/opencode-plugins/commit/9c7152559776aaf80cfed9626d78bafdd845fa9a))
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
### Refactors
|
|
48
|
+
|
|
49
|
+
* **lib:** one MCP tool grant table for the tools option ([f8cc1d8](https://github.com/srobroek/opencode-plugins/commit/f8cc1d817d62b211b712d1889200f7c91f049c89))
|
|
50
|
+
|
|
51
|
+
## [0.4.2](https://github.com/srobroek/opencode-plugins/compare/worktrunk--v0.4.1...worktrunk--v0.4.2) (2026-11-19)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
### Bug Fixes
|
|
55
|
+
|
|
56
|
+
* **beads:** decide the actor gate on the parsed command, not re-joined argv ([#187](https://github.com/srobroek/opencode-plugins/issues/187)) ([9eaabde](https://github.com/srobroek/opencode-plugins/commit/9eaabde95f1dd57d0a650a8c6435455c004e28d2))
|
|
57
|
+
|
|
58
|
+
## [0.4.1](https://github.com/srobroek/opencode-plugins/compare/worktrunk--v0.4.0...worktrunk--v0.4.1) (2026-11-16)
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
### Documentation
|
|
62
|
+
|
|
63
|
+
* **skills:** add a per-skill references/pitfalls.md standard and a check ([#178](https://github.com/srobroek/opencode-plugins/issues/178)) ([ff2489a](https://github.com/srobroek/opencode-plugins/commit/ff2489af6aab145e3a5e6be8462d390b43395ae7))
|
|
64
|
+
|
|
65
|
+
## [0.4.0](https://github.com/srobroek/opencode-plugins/compare/worktrunk--v0.3.0...worktrunk--v0.4.0) (2026-11-12)
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
### Features
|
|
69
|
+
|
|
70
|
+
* **safety:** refuse direct 1Password reads and literal secrets in commands, pointing to fnox ([#131](https://github.com/srobroek/opencode-plugins/issues/131)) ([36cd391](https://github.com/srobroek/opencode-plugins/commit/36cd3912e954c1078b808802b069d7010d8f319f))
|
|
71
|
+
|
|
72
|
+
## [0.3.0](https://github.com/srobroek/opencode-plugins/compare/worktrunk--v0.2.0...worktrunk--v0.3.0) (2026-11-11)
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
### Features
|
|
76
|
+
|
|
77
|
+
* **agent-efficiency:** add lead routing, a foreground sleep guard and subagent scratch reminders ([#122](https://github.com/srobroek/opencode-plugins/issues/122)) ([34bdb2d](https://github.com/srobroek/opencode-plugins/commit/34bdb2d512109065956f88397bd2dc8e6e99ecd3))
|
|
78
|
+
|
|
79
|
+
## [0.2.0](https://github.com/srobroek/opencode-plugins/compare/worktrunk--v0.1.0...worktrunk--v0.2.0) (2026-10-27)
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
### Features
|
|
83
|
+
|
|
84
|
+
* **agent-efficiency:** run bash tool calls as the built-in shell tool ([bdca7d7](https://github.com/srobroek/opencode-plugins/commit/bdca7d779c47d9cd2cdc6db8d8a8d5f78a3ba8cc))
|
|
85
|
+
* generate Claude Code and Codex marketplaces ([59ae2a2](https://github.com/srobroek/opencode-plugins/commit/59ae2a2775ec41c30b57570f84ce7f7052a49f7f))
|
|
86
|
+
* **lib:** add dependency detection, skill registration and fake skill/assert domains ([9a7b6e3](https://github.com/srobroek/opencode-plugins/commit/9a7b6e3b6f89bd2230361797c74a07df00197944))
|
|
87
|
+
* **lib:** register shipped agent files and content-only plugins ([df7fa53](https://github.com/srobroek/opencode-plugins/commit/df7fa53ac93f0327a1735fcf1e5c6017d0216754))
|
|
88
|
+
* **worktrunk:** add wt worktree strategy, merge-policy gate and skills ([3428fc8](https://github.com/srobroek/opencode-plugins/commit/3428fc87b4929da3122eee1e7bbf25de43239767))
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
### Bug Fixes
|
|
92
|
+
|
|
93
|
+
* **lib:** accept numeric signal codes from @types/bun 1.4.4 ([a3d2e42](https://github.com/srobroek/opencode-plugins/commit/a3d2e4225211d1a288fa3fed561e1c9d8e696284))
|
|
94
|
+
* **worktrunk:** guard wt and git runs against lost exit events ([1767bf8](https://github.com/srobroek/opencode-plugins/commit/1767bf80ae4e99fbe22cdc8725166c36a20753ca))
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
### Performance
|
|
98
|
+
|
|
99
|
+
* shorten skill descriptions and hide pure reference skills from the listing ([51841bd](https://github.com/srobroek/opencode-plugins/commit/51841bd68ae7fe809711430fe3430b75b63e81c0))
|
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,136 @@
|
|
|
1
|
-
#
|
|
1
|
+
# worktrunk
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[Worktrunk](https://github.com/max-sixty/worktrunk) (`wt`) support for OpenCode V2. Ported from the
|
|
4
|
+
omp-plugins `worktrunk` package. The omp isolation precheck is not ported: OpenCode has no native
|
|
5
|
+
checkout-cloning isolation to refuse.
|
|
6
|
+
|
|
7
|
+
It does three things:
|
|
8
|
+
|
|
9
|
+
- Registers `wt` as OpenCode's worktree strategy.
|
|
10
|
+
- Gates `wt merge` shell calls so worker-to-epic merges keep their history.
|
|
11
|
+
- Ships two skills: `worktrunk-preflight` and `worktrunk-worktrees`.
|
|
12
|
+
|
|
13
|
+
## Install
|
|
14
|
+
Install the Pi package from npm:
|
|
15
|
+
|
|
16
|
+
```sh
|
|
17
|
+
pi install npm:@srobroek/pi-worktrunk-merge-policy
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
```sh
|
|
21
|
+
opencode plugin add 'github:srobroek/harness-plugins::path:plugins/worktrunk/opencode'
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Claude Code install the skills from this repository's marketplace:
|
|
25
|
+
|
|
26
|
+
```sh
|
|
27
|
+
claude plugin marketplace add srobroek/harness-plugins
|
|
28
|
+
claude plugin install worktrunk@harness-plugins
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Claude Code get the two skills only; the worktree strategy and merge gate are OpenCode code.
|
|
33
|
+
|
|
34
|
+
Needs `wt` and `git` on `PATH`. The preflight skill also needs `python3` (3.11 or later).
|
|
35
|
+
|
|
36
|
+
## Options
|
|
37
|
+
|
|
38
|
+
| Option | Default | Effect |
|
|
39
|
+
| --- | --- | --- |
|
|
40
|
+
| `strategy` | `true` | `false` keeps OpenCode's bundled Git strategy. The merge gate and the skills stay on. |
|
|
41
|
+
|
|
42
|
+
```jsonc
|
|
43
|
+
{ "plugins": [{ "package": "...", "options": { "strategy": false } }] }
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Worktree strategy
|
|
47
|
+
|
|
48
|
+
Strategy id `worktrunk`. Adding it makes it OpenCode's default strategy; disposing the plugin
|
|
49
|
+
restores the previous one. Worktrees created before the plugin loaded keep their recorded owner.
|
|
50
|
+
|
|
51
|
+
| Operation | Command |
|
|
52
|
+
| --- | --- |
|
|
53
|
+
| create | `wt -C <source> switch -y --create --no-cd --base <ref> --format json <name>` |
|
|
54
|
+
| remove | `wt -C <directory> remove -y [--force] --foreground` |
|
|
55
|
+
| list | `wt -C <source> list --format json` |
|
|
56
|
+
|
|
57
|
+
- `<name>` is the last component of the directory OpenCode suggests, and becomes the new branch.
|
|
58
|
+
`wt` picks the directory from its `worktree-path` template, and the strategy returns that path,
|
|
59
|
+
so the worktree may not sit where OpenCode suggested. OpenCode's `worktree.directory` setting has
|
|
60
|
+
no effect on this strategy.
|
|
61
|
+
- `<ref>` is the requested starting ref. Without one it is the source checkout's `HEAD` commit.
|
|
62
|
+
- Worktrunk hooks run as usual: `pre-start` hooks block creation, `post-start` hooks run in the
|
|
63
|
+
background.
|
|
64
|
+
- `remove` deletes the branch only when `wt` considers it merged, and never deletes unmerged
|
|
65
|
+
commits. A dirty worktree is refused with `forceRequired`, so OpenCode asks before forcing.
|
|
66
|
+
Removing a directory that no longer exists does nothing.
|
|
67
|
+
- `list` reports the main worktree as `root` and every linked worktree as `worktree`.
|
|
68
|
+
|
|
69
|
+
## Merge policy gate
|
|
70
|
+
|
|
71
|
+
`execute.before` on the `shell` tool. It refuses:
|
|
72
|
+
|
|
73
|
+
- `wt merge <target>` to a target other than the default branch without both `--no-squash` and
|
|
74
|
+
`--no-ff`;
|
|
75
|
+
- such a merge run from the target worktree, or from a detached `HEAD`, because `wt merge`
|
|
76
|
+
merges the current branch;
|
|
77
|
+
- a merge it cannot check: the default branch cannot be resolved, a probe times out, or the
|
|
78
|
+
command is unterminated or runs a merge stored in a variable (`cmd="wt merge x"; eval "$cmd"`).
|
|
79
|
+
|
|
80
|
+
`wt merge` with no target and merges to the default branch pass. The gate reads the default branch
|
|
81
|
+
from `wt config state default-branch`, then `origin/HEAD`, in the call's directory: the shell
|
|
82
|
+
`workdir` (resolved against the session directory), a leading `cd DIR &&`, or `wt -C DIR`. It
|
|
83
|
+
finds merges behind wrappers (`env`, `sudo`, `timeout`, ...), in `$(...)`, backticks, process
|
|
84
|
+
substitutions, `eval` and `sh -c`. `git merge` and `gh pr merge` are not gated.
|
|
85
|
+
|
|
86
|
+
## Skills
|
|
87
|
+
|
|
88
|
+
Registered with `ctx.skill.transform` from `skills/<name>/SKILL.md` in this package, so no copy step
|
|
89
|
+
is needed. `skills/` ships with the package (`files`), and both `src/` and the bundled `dist/`
|
|
90
|
+
resolve it as `../skills`. A skill with the same id that the host already has wins.
|
|
91
|
+
|
|
92
|
+
- `worktrunk-preflight`: `preflight.py` checks `wt`, hook approvals, ignored project-config keys,
|
|
93
|
+
the default branch, merge evidence, provisioning hooks and `node_modules`. Read-only unless
|
|
94
|
+
`--apply`. Python tests: `skills/worktrunk-preflight/test_preflight.py`, run by `bun test`. On pi
|
|
95
|
+
the skill calls the `worktrunk_preflight` tool instead (below).
|
|
96
|
+
- `worktrunk-worktrees`: the worktree discipline from the omp rule `worktrunk-worktree-required`:
|
|
97
|
+
create with `wt switch`, cut from the recorded base commit, use absolute paths, wait for
|
|
98
|
+
provisioning, merge from the source worktree.
|
|
99
|
+
|
|
100
|
+
## pi
|
|
101
|
+
|
|
102
|
+
One extension, `pi/extensions/worktrunk.js` (source `pi-src/worktrunk.ts`). The merge gate and the
|
|
103
|
+
`wt switch` timeout share `shared/merge-gate.ts` and `shared/switch-timeout.ts` with OpenCode.
|
|
104
|
+
|
|
105
|
+
| Feature | pi hook | Behavior |
|
|
106
|
+
| --- | --- | --- |
|
|
107
|
+
| Merge policy gate | `tool_call` on `bash` | Returns `{ block: true, reason }` for every merge the OpenCode gate refuses, checked in `ctx.cwd`. A handler error blocks the call, as pi treats a throwing `tool_call` handler. |
|
|
108
|
+
| `wt switch` timeout | `tool_call` on `bash` | Raises a `timeout` shorter than 600 s to 600 s on a `wt switch` call, so foreground hooks are not killed mid-provisioning. pi's bash tool has no default timeout, so a call without one is left alone. |
|
|
109
|
+
| `worktrunk_preflight` tool | `registerTool` | The checks of `preflight.py`, ported to TypeScript in `shared/preflight.ts` with the same ids, statuses and `{ ok, summary, checks }` JSON. Parameters: `path` (default: the session directory), `only` (check ids), `apply`. `apply` writes `.config/wt.toml` under pi's file-mutation queue. |
|
|
110
|
+
|
|
111
|
+
The worktree strategy has no pi counterpart: pi has no worktree-strategy hook. pi-subagents allocates
|
|
112
|
+
its child worktrees itself, running `wt -C <root> switch --create <branch> --base <commit> --no-cd
|
|
113
|
+
--no-hooks --format json` with `spawnSync` from its extension process, not through the bash tool.
|
|
114
|
+
pi fires `tool_call` only for tool calls, so neither gate sees that allocation.
|
|
115
|
+
|
|
116
|
+
pi-subagents' foreground children do not load the parent's extensions ([required host extensions](https://github.com/nicobailon/pi-subagents/blob/main/docs/agents.md#required-host-extensions)). List this extension for every child in `~/.pi/agent/settings.json`, with the path where pi installed this repository:
|
|
117
|
+
|
|
118
|
+
```json
|
|
119
|
+
{
|
|
120
|
+
"subagents": {
|
|
121
|
+
"defaultSubagentOnlyExtensions": ["<harness-plugins>/plugins/worktrunk/pi/extensions/worktrunk.js"]
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
An agent that sets its own `subagentOnlyExtensions` replaces this default, so it must list the path too.
|
|
127
|
+
The Python script stays for OpenCode and Claude Code; the two implementations must change together.
|
|
128
|
+
|
|
129
|
+
## Smoke test
|
|
130
|
+
|
|
131
|
+
```sh
|
|
132
|
+
bun plugins/worktrunk/opencode/scripts/smoke.ts
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Creates a scratch repository, then creates, lists, refuses to remove while dirty, force-removes and
|
|
136
|
+
lists again through the strategy with real `wt`. It runs your Worktrunk config and hooks.
|